Livecode Wiki
m (1 revision)
mNo edit summary
Tag: Visual edit
Line 1: Line 1:
Specifies whether a [[stack]] is purged from memory when it's closed, or whether it remains in memory.Syntax:
+
Specifies whether a [[stack]] is purged from memory when it's closed, or whether it remains in memory. Syntax:
 
set the destroyStack of <nowiki><stack></nowiki> to {true | false}
 
set the destroyStack of <nowiki><stack></nowiki> to {true | false}
   
Line 5: Line 5:
 
set the destroyStack of this stack to true
 
set the destroyStack of this stack to true
   
Use the [[destroyStack]] [[property]] to leave a [[stack]] in memory after it
+
Use the [[destroyStack]] property to leave a [[stack]] in memory after it
 
is closed.
 
is closed.
   
If a stack's [[destroyStack]] [[property]] is set to true, closing all
+
If a stack's [[destroyStack]] property is set to true, closing all
[[stacks]] in its [[stack file]] removes it from memory space, cleaning up
+
[[stacks]] in its stack file removes it from memory space, cleaning up
after the [[stack]] and freeing memory for use by the [[application]]. If
+
after the [[stack]] and freeing memory for use by the application. If
 
any [[handler|handlers]] in the stack are running, the stack is not purged
 
any [[handler|handlers]] in the stack are running, the stack is not purged
from memory until all [[handler|handlers]] have completed. (The [[stack]] is
+
from memory until all [[handler|handlers]] have completed. (The stack is
not removed from memory until all [[stacks]] in the same [[stack file]] are
+
not removed from memory until all stacks in the same stack file are
 
also closed.)
 
also closed.)
   
If the [[destroyStack]] is false, closing a [[stack window|stack's window]]
+
If the [[destroyStack]] is false, closing a stack's window
leaves it in memory. If you open and close many [[stacks]] in a session,
+
leaves it in memory. If you open and close many stacks in a session,
and the [[destroyStack]] of all these [[stacks]] is false, the memory used
+
and the [[destroyStack]] of all these stacks is false, the memory used
by these [[stacks]] will continue growing until you quit the
+
by these stacks will continue growing until you quit the
[[application]]. If you reopen the [[stack]] during the same session, a
+
application. If you reopen the stack during the same session, a
warning message appears cautioning you that the [[stack]] is already open.
+
warning message appears cautioning you that the stack is already open.
   
 
If you close a stack whose [[destroyStack]] is true while a [[handler]] is
 
If you close a stack whose [[destroyStack]] is true while a [[handler]] is
 
running, the [[stack]] is removed from memory after all running
 
running, the [[stack]] is removed from memory after all running
[[handler|handlers]] finish [[execute|executing]]. This means that if you
+
handlers finish executing. This means that if you
close and re-open a [[stack]] during a [[handler]], and the [[stack|stack's]]
+
close and re-open a stack during a handler, and the stack's
 
[[destroyStack]] is true, the stack is removed from memory (and closed
 
[[destroyStack]] is true, the stack is removed from memory (and closed
 
again) after the [[handler]] finishes.
 
again) after the [[handler]] finishes.
   
Despite its alarming name, the [[destroyStack]] [[property]] does
+
Despite its alarming name, the [[destroyStack]] property does
not destroy or damage a [[stack]]. It simply allows it to be
+
not destroy or damage a stack. It simply allows it to be
 
automatically removed from memory.
 
automatically removed from memory.
   
See also: [[hasMemory]] (function),[[reloadStack]] (message),[[stack]] (object),[[destroyStack]] (property),
+
See also: [[hasMemory]] (function),[[reloadStack]] (message),[[stack]] (object)
 
[[Category: windowing]]
 
[[Category: windowing]]

Revision as of 13:08, 22 February 2019

Specifies whether a stack is purged from memory when it's closed, or whether it remains in memory. Syntax:

set the destroyStack of <stack> to {true | false}

Examples:

set the destroyStack of this stack to true

Use the destroyStack property to leave a stack in memory after it is closed.

If a stack's destroyStack property is set to true, closing all stacks in its stack file removes it from memory space, cleaning up after the stack and freeing memory for use by the application. If any handlers in the stack are running, the stack is not purged from memory until all handlers have completed. (The stack is not removed from memory until all stacks in the same stack file are also closed.)

If the destroyStack is false, closing a stack's window leaves it in memory. If you open and close many stacks in a session, and the destroyStack of all these stacks is false, the memory used by these stacks will continue growing until you quit the application. If you reopen the stack during the same session, a warning message appears cautioning you that the stack is already open.

If you close a stack whose destroyStack is true while a handler is running, the stack is removed from memory after all running handlers finish executing. This means that if you close and re-open a stack during a handler, and the stack's destroyStack is true, the stack is removed from memory (and closed again) after the handler finishes.

Despite its alarming name, the destroyStack property does not destroy or damage a stack. It simply allows it to be automatically removed from memory.

See also: hasMemory (function),reloadStack (message),stack (object)