Purge and global variables

Richard Gaskin ambassador at fourthworld.com
Wed Jan 15 16:34:01 EST 2003


Jan Schenkel wrote:

> You're right, the first time a global is delcared,
> it's empty. But a global isn't 'purged' along with the
> stack that created it -- mainly because you should be
> able to use it in other stacks as well.
> So this won't cause problems in a stand-alone, as the
> memory is released when the program is quit, and other
> programs normally can't read+write it anyway.
> But under the Development Environment, it's kept in
> memory until you 'delete' the global or quit RunRev
> alltogether.
> 
> If you want to reset it upon closing the stack, I
> suggest you trap the 'closeStack' message:
> 
> on closeStack
> global gThatAnnoyingGLobal
> delete global gThatAnnoyingGLobal
> end closeStack

Or if it's only used on one script you could use a script-local variable to
get the same effect.


-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Developer of WebMerge 2.1: Publish any database on any site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the use-livecode mailing list