Left-overs from a past life....

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Left-overs from a past life....

Post by RossG » Thu Nov 12, 2015 4:51 am

My current project is a modification from one I did some years ago.

To the best of my knowledge I removed the code, buttons etc. I didn't
need but there's some stuff I can't find which is annoying me although
not affecting the programme

Sometimes I open the original programme, close it and then open the
new one. At that point I get an alert that there's another copy of this
unwanted item already in memory. What's it doing there? I closed the
programme. It should have had the decency to go with its code, stack,
button or whatever.

You could say it's academic but still annoying.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Left-overs from a past life....

Post by Simon » Thu Nov 12, 2015 6:12 am

Hi RossG,
From the Project Browser right click and select "Close and remove from memory"

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: Left-overs from a past life....

Post by RossG » Thu Nov 12, 2015 9:58 am

Simon

I am so used to just "Closing" that I don't think of the other option.

Why would one want to "Close" without removing from memory?
Does leaving it in memory have some purpose?
If not then "Close" should remove it from memory.

In the distant past ('80's) it was considered uncouth for a
programme to leave its left-overs in the (then very limited)
memory. The standard closing statements in a FoxPro 2 script
were:

Close all
Clear all
Delete all

Which did the whole thing in three lines.

And of course I can blame FoxPro for my constant use of
endif.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Left-overs from a past life....

Post by dunbarx » Thu Nov 12, 2015 3:04 pm

Hi.

Set the "destroyStack" and the "destroyWindow" to "true" in the property inspector. See these in the dictionary. They are not as draconian as they appear.

Craig Newman

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Left-overs from a past life....

Post by FourthWorld » Thu Nov 12, 2015 4:55 pm

RossG wrote:Why would one want to "Close" without removing from memory?
Does leaving it in memory have some purpose?
It's very rare that you'll find programmers of any development tool going out of their way to design features that have no purpose.

In LiveCode, stack files are cached for performance, allowing them to be used within the session without having to load and unpack them from disk each time, unless that's something you explicitly want to do.

For example, if you made a library of user interface stacks like dialogs or document templates, those would only need to be unpacked once and would appear instantly every time they're called after that.
In the distant past ('80's) it was considered uncouth for a
programme to leave its left-overs in the (then very limited)
memory.
RAM was much more expensive in the '80s, so swapping from disk was an unfortunately frequent necessity.

Still, like any usefully flexible tool LiveCode leaves the developer in control of this caching:
The standard closing statements in a FoxPro 2 script
were:

Close all
Clear all
Delete all

Which did the whole thing in three lines.
Even simpler in LiveCode:

Like Craig said, you can set the destroyStack and destroyWindow properties of the stack in the Inspector (or via script if you prefer). Once saved those properties are persistent, so going forward instead of FoxPro's three lines you'd only need one:

close stack <stackName>
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Left-overs from a past life....

Post by jacque » Fri Nov 13, 2015 4:18 pm

Another example: I have a project that downloads many large stacks from a remote server on demand. These are opened and closed repeatedly during a session. If the stacks were removed from RAM on close, they would need to be re-downloaded every few minutes. For that reason I have intentionally left destroystack set to false on those stacks.

Normally I have my LC prefs set to create all new stacks with destroystack set to true. This case was an exception.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply