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)

Community content is available under CC-BY-SA unless otherwise noted.