Unloading libraries

So I was reading the excellent article about libraries last night in the unscripted section (TJ, I think).

It recommends setting your loaded script back to null or “” empty string. Makes good sense. I have been dealing with libraries quite a bit lately, so I thought I better look into this. So I made a simple script that simply loaded my libraries. I didn’t use them or anything, just loaded them into a variable. After a short delay, I would Unload them by setting them to null or empty string. I put this into a repeat loop, and let it run.

I opened up Activity Monitor, and watched the System Memory Tab, and the Info on my script. The memory just kept climbing and climbing and going up, up, up. Everytime it loaded, and every time it unloaded, the memory would creep up.

This is at the very heart of my project, and running out of memory is scaring me. I want stability enough to run these things for months at a time!

Can anybody out there confirm this? Anybody able to flush out their variables so they don’t consume all the RAM? Or am I maybe doing something wrong? I tried many iterations of loading, resetting, delaying for awhile. What gives?

err…maybe I overreacted.

Seems as thought OSX is smarter than me. It seems to reallocate only when needed. Further testing shows the memory usage dropping when other apps open and are used.

Thanks for your help, Shane