I am new in LotusScript and have a general question about the method ‘Terminate’.What is usually done there? Is it important to set some objects (like DocumentCollection) to null/Nothing to release memory?
Thanks for any hints and tips
I am new in LotusScript and have a general question about the method ‘Terminate’.What is usually done there? Is it important to set some objects (like DocumentCollection) to null/Nothing to release memory?
Thanks for any hints and tips
Subject: LotusScript / Terminate
The “Terminate” and “Initialize” routines do pretty much what’s on the box. Anything dumped in the Terminate event will get triggered as your module finishes (i.e. unloads).
This is useful for de-allocating objects (should you feel the need – Lotusscript does its own memory management pretty well, but in heavy convoluted code this simple de-allocation is perhaps advisable), but more to the point you can dump logging info, NotesTimer stuff, and so on here. That’s in addition to any other code that should run right at the end of course. Essentially, Terminate is for “cleaning up”.
You can take advantage of which events get triggered in what order in your code of course (for example, a script library “Terminate” will occur after the “Terminate” event in an agent using that library) – look up “Event sequencing” in Designer help for a table outlining event order.
Hope that helps a little.
–
Subject: LotusScript / Terminate
Christian,
The Terminate event executes before the agent execution finishes. You don’t have to set anything to null - Lotusscript manages memory for you.
HTH,
Mark
Subject: LotusScript / Terminate: Some addtl. info…
You don’t have to kill your objects in the terminate event, Lotusscript does that automatically for you. The only reason why you potentially would want to kill your objects manually is if they need to be terminated in a specific order, because the Lotusscript automatic garbage collector doesn’t do it neccessarily in the same order as objects had been created.This might only be an issue of you have complex chains of inherited/derived classes and you rely on the exact sequence of objects being created/deleted the way you want it.
Thomas - IBM