A memory management issue

Geoff Canyon gcanyon at inspiredlogic.com
Fri Jan 4 15:10:01 EST 2002


>I'm building a project that will have a total of 1,650 cards, with each card
>containing one field holding approximately 20k of formatted text.
>
>I was thinking of splitting this into 4-5 separate substacks, each being
>about 4-5 MB in size.
>
>The main stack would contain an index to all 1,650 cards, from which the
>user can pull up information on any one card. My concern is with minimizing
>memory requirements.
>
>My understanding is that as soon as the main stack is opened, all 20 MB's
>worth of substacks will be pulled into RAM as well...which I don't think
>will work for my average customer.
>
>I realize I could make each substack into a main stack instead, and
>theoretically copy the contents of a formatted field from any given card in
>one of those stacks into a field in my primary main stack (which is not
>large in size). Then I would have to immediately use the destroystacks()
>function to purge that data stack from memory. I could basically swap data
>stacks into and out of memory, but this seems like a rather ugly approach.
>Perhaps it's the best way, though.
>
>Suggestions?
>Richard Miller

Off the top of my head, is there a reason the 20k of formatted text needs to be in a stack at all? Using a stack as an intelligent interface to 1650 text files would be fairly simple and clean to implement, although it does mean you have 1650 data files on disk for the user to play with/mess up. With URL file access, something like this could be done with a very simple script.

regards,

Geoff




More information about the use-livecode mailing list