[jawsscripts] Re: Clearing objects after use

Global variables that are object references should be cleared by
assigning something else to them, such as a null, when the objects are
no longer needed.  Local variables do not need to be cleared
explicitly like this though, because they are effectively cleared when
the containing script or function exits.  Globals have to be cleared
because they are never cleared automatically until you unload JAWS.  I
even recommend clearing globals that may contain large strings for the
same reason.  Ints, handles, and small strings aren't a big deal to
keep hanging around.

On Fri, Nov 14, 2008 at 08:40:17PM +1100, Paul Magill wrote:
Hi,

I was going to add this in a reply to a post, that suggested that not 
clearing objects after use may be the cause of problems with Jaws, but I 
lost that post, so am now guessing at the context...

When finished with objects that have been created in scripts, they should be 
nulled, or cleared, so they do not remain in memory.

*. This is particularly important when those objects have been declared as 
globals.

Though, in theory, objects declared inside functions or scripts are cleared 
when that script or function ends, it wont hurt to also null the object at 
the end of the script or function.

This idea & method was not developed by me, but by Jamal Mazrui, & I have 
simply used what he so generously published on the list.

Where your objects are declared, also declare an extra object which is used 
for absolutely nothing other than to Null the others when you have done with 
them.

.... other object declarations,
object   O_Null,
...other declarations

Then where the use of an object is finished...

let O_AnyOneOfYourObjects = O_Null


Objects left in memory may not be the cause of your problem with Jaws, but 
if it is, then the above may help.

Regards,
Paul from Aust
 

__________?
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: