Re: Applescript and memory
Re: Applescript and memory
- Subject: Re: Applescript and memory
- From: Christopher Nebel <email@hidden>
- Date: Mon, 4 Jan 2010 12:39:44 -0800
On Jan 4, 2010, at 6:51 AM, Bert Groeneveld wrote:
> I was wondering where a running Applescript stores it's temporary information such as the values of variables. And more important if there is a need to clean up this "memory" from time to time, to keep up the good performance of the computer. And how that easily can be done (if needed).
>
> Background information: I have several (stay open) scripts, watching folders for incoming jobs, on a dedicated 10.5.8 MacPro computer. These scripts talk to the Finder, Excel, TextWrangler, Image Events, System Events, several scripting additions (such as 24U Email) and InDesign CS3. Some scripts have 4000+ lines, so there's a lot of information to deal with. The computer is 24/7 up. This all made me wondering if it was a good idea to clean up the space where the temporary information is stored (whereever that space may be on the computer, or how big this information is). Any suggestions are welcome.
Short answer: No. Like most scripting languages, AppleScript is garbage-collected, which means that values you're no longer using (say, because you assigned over them, or the variables they were stored in went out of scope) get cleaned up automatically.
Longer answer: Maybe. Even in a garbage-collected environment, it's possible to effectively "leak" memory by hanging on to more data than you realize. The real answer to this question is: do you appear to have an actual problem with unbounded memory growth, as demonstrated by measuring it in, say, Activity Monitor? If not, then sit back and relax. If so, then examine what data you're retaining and make sure you actually need it.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden