I'm mystified by the menu item
"Close and Remove From Memory".
It implies that closing a stack doesn't
release the (global?) variables which
seems to be a failure in the "garbage
collection" department.
Does this item have a particular use?
When should and shouldn't it be used?
File/Close and Remove From Memory...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
File/Close and Remove From Memory...
Life is just a bowl of cherries.
Dear bjb,
Closing a stack means that the window is closed. If the destroyStack of the stack is false, the window will be closed but the stack will stay in memory. You can still use the go command in combination with the short name of the stack to make the window re-appear.
If you remove the stack from memory, Revolution completely forgets about it and you can no longer use the short name of the stack to show the window again. If you want to open the stack, you need to use the file path to refer to it.
I don't think that global variables are released simply by removing a stack from memory.
Best,
Mark
Closing a stack means that the window is closed. If the destroyStack of the stack is false, the window will be closed but the stack will stay in memory. You can still use the go command in combination with the short name of the stack to make the window re-appear.
If you remove the stack from memory, Revolution completely forgets about it and you can no longer use the short name of the stack to show the window again. If you want to open the stack, you need to use the file path to refer to it.
I don't think that global variables are released simply by removing a stack from memory.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Just to add to that, 'global' variables are never released during the time the IDE or your standalone application is opened. It doesn't matter if the global variable is only declared inside one stack, it si effectively global for the entire runtime environment.
So if you're sure your global variable isn't used by other stacks, you may want to clean up the memory in your 'closeStack' event handler.
If you want your 'variables' to be linked to the stack you're using them in, you could use custom properties but that's food for another post.
Hope this helped,
Jan Schenkel.
So if you're sure your global variable isn't used by other stacks, you may want to clean up the memory in your 'closeStack' event handler.
Code: Select all
on closeStack
global gMySettings
delete global gMySettings
end closeStack
Hope this helped,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com