Re: Big lists in top level variables = stack overflow
Re: Big lists in top level variables = stack overflow
- Subject: Re: Big lists in top level variables = stack overflow
- From: has <email@hidden>
- Date: Tue, 12 Jul 2005 19:18:37 +0100
Eric Geoffroy wrote:
>>>I have an applet that throws an error message just as it finishes executing.
>>>
>>>"Could not save changes to the script "EarlyBert.app" because the script's stack overflowed.
>>>-2706
>>
>>Any big list objects (> 4000 items) sitting in top-level/property/global variables?
>
>Is the best course of action for top level big lists to -
>
>a) zero out the list before the end of the script.
You can try that, although ISTR the AS garbage collector may not clean it up in time, in which case you still get the error.
>b) move the big list from top level to handler.
Storing the list in local variables should fix it.
>c) other?
If you really need to keep values in top-level properties but don't want them to persist between runs, and if the applet doesn't need to do event handling, you could make a local copy of the entire script and run that. IIRC, something like this will do it:
on run
local scpt
copy me to copyScript
copyScript's main(me)
end run
on main(originalScript)
-- main code goes here instead of in run
end main
Clumsy trick, but it works. Data stored in top-level properties in the duplicate script will be cleaned up when that script object is disposed of. If you do need to store some values between runs, use "set originalScript's someProperty to someValue" in main() to store them in top-level properties in the original script object.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden