Memory and file size strategy

Jim Hurley jhurley at
Mon Oct 20 10:30:30 EDT 2003

>At 2:43 PM -0700 10/19/03, Jim Hurley wrote:
>>I have a project which has 5 components. Each of these components is
>>rather large.
>>I want to keep the file size and the memory-use to a minimum.
>>To keep the file size to a minimum, I presume I should use a one
>>main stack with 5 substacks.
>>But won't the substacks be loaded into memory as the main stack is
>>opened? Is there a way for each of the substacks to be loaded into
>>memory only as called for? And each substack closed and removed from
>>memory (destroystack = true for each substack) when not in use?
>A stack file is loaded into memory all at once - main stack plus any
>substacks - so this isn't an optimal strategy for reducing memory use.
>If you move your substacks into separate stack files, though, they
>can be loaded "on demand", and when closed will be removed from
>memory (assuming their destroyStack and destroyWindow are true).
>Jeanne Devoto wrote:
>There are some additional approaches you may want to look at,
>depending on the nature of the application:
>- Keep media (pictures, movies, sounds) in separate files, using
>referenced images and players instead of imported images and audio-
>and video-clips. Referenced media doesn't need to be loaded into
>memory until you go to a card that the image or movie is used on.
>For example, if you have a stack with many cards that has a large
>image on each card, you can save a lot of memory by keeping the
>images in external files and setting the filename property instead of
>importing them into the stack.
>- Keep large hunks of text in separate files, reading them in only
>when necessary. For example, for a stack that includes a number of
>lengthy historical documents, you can store the documents' htmlText
>in separate files until the user calls for a specific document to be
>- Consider using an external database to store large amounts of data
>that need to be searched and sorted.
>Jeanne DeVoto ~ jeanne at ~
>Runtime Revolution - User-Centric Development Tools
>~~~ Check our web site for new Revolution editions & special offers ~~~

Jeanne and David,

Thanks for the memory tips. They are all helpful. (Some day I'm going 
to figure out how to use an external database!)

Turns out I couldn't use my 5 components as substack of the main 
stack anyhow, since they contain substacks themselves and, as I 
discovered, there can be no substacks of substacks.

Given the need to access disk files I need a little info on finding 
disk folders. I think I can manage that in the eventual stand-alone 
since the default folder becomes the folder from which the main stack 
is opened.

But while in the development stage that default is the folder 
containing the RunRev application. I wonder how one would determine 
the folder from which the current stack has come. I can find it using 
"ask folder", but is there a way without asking--programmatically? 
Clearly RunRev knows, since it knows where to save the file.

P.S. Can the new and improved list server handle formatted messages?


More information about the Use-livecode mailing list