Memory Management in Script Libraries?

I’ve read Shane Stanley’s article here about memory management in ASOC apps but I’m wondering what the rules are for ASOC libraries, where there are no “build settings”. Do I need to use “release” etc or does it actually not matter whether I do or don’t?
I ask because I’ve been using release and have had crashes which are resolved by not using release but I just wanted to check if it’s okay to not use it.

Don’t use release. It’s only going to confuse things.

Great, good to know!
So if I want to reallocate a new object to the same variable, is there anything else I need to do?

set x to SomeObject's alloc()'s init()
-- do stuff with x
set x to SomeObject's alloc()'s init()
-- do stuff with a new x

Is this fine just like that?


To be clear: Script libraries are run as part of AppleScript, not as pseudo-Objective-C classes. As such, memory management is an issue for AppleScript and the scripting bridge. Basically, AppleScript keeps objects alive as long as there’s an AppleScript reference to them, and destroys them when AppleScript no longer has a reference to them.

Good, that does clear it up, thanks Shane.
(you wouldn’t believe how long it took me to work out my stability problems were caused by release)