Re: memory, buffered images and closed stacks (and groups?)

2011-07-29 Thread Nicolas Cueto
> 1) Set the 'destroyStack' property of the stack to true. WHen it closes, it 
> should be purged from memory.
> 2) Issue the "delete stack " command, but BE CAREFUL!!! - if 
>  is a *substack*, the stack will ACTUALLY BE DELETED; if the stack 
> is a *mainstack*, it will close the stack and remove it from memory. (I tend 
> to use something like "if the mainstack of  = the short name of 
>  then delete stack ".)
>
> The way you can test is to look at "the mainstacks" if the name of the 
> stack is no longer in "the mainstacks", then it has been closed and purged 
> from memory.

Thanks Ken. Tried your suggestions. The game stack doesn't appear in
the mainstacks, its destroyStack is true, and I do a "delete stack"
even though mainstacks doesn't list the game stack.

And yet, memory values after the game stack has  been confirmed as
closed are 2000 to 3000 K larger than when the game stack was first
opened.

So, I'm still wondering if this memory discrepancy is connected to my
stack crashing immediately before using the command "group" after the
game stack has been re-opened.

--
Nicolas Cueto

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: memory, buffered images and closed stacks (and groups?)

2011-07-28 Thread Ken Ray

On Jul 29, 2011, at 12:27 AM, Nicolas Cueto wrote:

> Hello.
> 
> Actually, this is about a crash caused by the command "group". Which I
> explain further down. But first...
> 
> How can I make sure that a closed stack releases all memory, i.e.,
> that the stack is "really" closed?

You can do one of the following:

1) Set the 'destroyStack' property of the stack to true. WHen it closes, it 
should be purged from memory.
2) Issue the "delete stack " command, but BE CAREFUL!!! - if 
 is a *substack*, the stack will ACTUALLY BE DELETED; if the stack 
is a *mainstack*, it will close the stack and remove it from memory. (I tend to 
use something like "if the mainstack of  = the short name of  
then delete stack ".)

The way you can test is to look at "the mainstacks" if the name of the 
stack is no longer in "the mainstacks", then it has been closed and purged from 
memory.

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/  

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


memory, buffered images and closed stacks (and groups?)

2011-07-28 Thread Nicolas Cueto
Hello.

Actually, this is about a crash caused by the command "group". Which I
explain further down. But first...

How can I make sure that a closed stack releases all memory, i.e.,
that the stack is "really" closed?

I'm prompted to ask cause of some odd memory results I'm encountering.
More or less, here's the memory usage as shown by Windows' Task
Manager:

1) Standalone and a central stack open = 38,000 K
2) Click a button on central stack so it hides itself and then opens a
game stack  = 40,000 K
3) Game stack does "stuff" to itself (cf. below) = 43,000 K
4) Close game stack and unhide central stack (standalone of course
still open) = 45,000 K

[Note that at (4), I confirm with "put the openstacks" that the
standalone and the central stack are indeed the only open stacks.]

The memory state at (4) seems significantly greater than at (1), is it
not? Or is this normal for LC?

About the "stuff" my game stack does to itself (!). When it opens, it
clones up to 36 group objects, each bearing buffered images. Plus
there's over 300 other buffered images, each of whose size property
ranges at about 2000. Also, the stack resizes itself as the game goes
along.



Finally, about that "group" crash. Which is what's really prompting me
to write this.

Everything's ok the first time that game stack of mine runs. But, when
I close it, return to the central stack, and then go back to the same
game stack, kaboom!

Took uninterrupted hours of trial-and-error till I isolated the
problematic script line in the game stack. Here's the naughty bit:

repeat for each item tTile in tGroupingData
 if there is not a group tTile then
put "WTF!" into tMsg
answer tMsg
exit to top
 end if
 set the selected of group tTile to true
end repeat
group
select empty

The line "group" is when the crash happens, after "end repeat" and
never getting to "select empty" (nor ever seeing a "WTF!").

I've already tried adding a "select empty" before the "repeat for",
and a "wait xxx milliseconds with messages" after the line "group".

So, now I'm trying the list :-)

Thanks.

--
Nicolas Cueto

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode