Rules governing stack purging

Dave Cragg dcragg at lacscentre.co.uk
Mon Oct 30 11:18:53 CST 2006


On 30 Oct 2006, at 16:48, Richard Gaskin wrote:

>
> I'm working with a client on a system that makes extensive use of  
> data stored in custom properties.
>
> I had been under the impression that as long as the stack  
> containing the data has its destroyStack set to true, and as long  
> as we don't open the stack, everytime we access its properties  
> we're getting it fresh from disk rather than from cached memory.
>
> Is that correct?

Perhaps not entirely, but I may have misunderstood your question.

If you access a stack without using open/go/toplevel/etc., for  
example by doing this:

   get the cMyProperty of stack "/Users/dave/myStack.rev"

then my understanding is that the stack will remain in memory until  
you delete it from memory, even it has the destroyStack set to true.  
Subsequents "gets" on the same stack will come from the memory  
version. Although I guess that would only make a difference if  
another app was saving the stack to disk while you had the stack in  
memory.

>
> We're in the process of pinning down some anomalies in our system  
> which would seem to suggest that accessing properties can cause a  
> stack to remain in memory such that subsequent accesses are  
> obtained from memory rather than from disk.

I think that's the case.

>
> And as for that purging, in the absence of a purge command there is  
> the workaround of using the delete command, but at the moment my  
> memory's flakey:  does using "delete stack" merely purge the stack  
> but not delete the actual stack if it's a mainStack, or if it's a  
> substack?

You can safely use "delete stack" with mainstacks. I typically use  
something like this when saving data to a "data only" stack.

set the cMyData of stack "/Users/dave/myStack.rev" to tData
save stack "/Users/dave/myStack.rev"
delete stack "/Users/dave/myStack.rev"


>
> And once we confirm which type of stack we can safely purge without  
> deleting it using the "delete stack" command, what method do we use  
> to purge stacks of the other kind?

By "other kind", do you mean substack. If so, I'm not sure as I've  
never used a substack as a data stack. However, I'd try deleting the  
substack's mainstack, and see if that works. But I'd *never* delete  
the substack.

Any help??


Cheers
Dave



More information about the use-livecode mailing list