Memory and file size strategy

Jeanne A. E. DeVoto jeanne at
Sun Oct 19 18:06:46 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).


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 ~~~

More information about the Use-livecode mailing list