Re: Out of memory??
Re: Out of memory??
- Subject: Re: Out of memory??
- From: "Stockly, Ed" <email@hidden>
- Date: Wed, 12 Apr 2006 12:40:10 -0700
>>me>>> I haven't seen this error in Mac OS 10, and thought they were a thing of the past.
>>Chris Nebel>>There are two likely culprits. One is the decompiler: it generates everything as styled text, and because styled text is limited to 32,767 style runs, if there are more style runs than that, it will throw an "out of memory" error. (This isn't particularly correct, but there you are.) "as string" and "as Unicode text" operations will also invoke the same mechanism, so a sufficiently large value could cause the same problem. The workaround is to set your all your source styles to the same thing.
OK that makes sense, one part of this script converts the accents, diacriticals and special characters from the exported inDesign output to proprietary tags used by our in-house pagination system, which includes a lot of "as string" commands on large chunks of text. There's probably over 100 tags I'm filtering.
But I don't get the "setting all source styles to the same thing". This error does not occur when the script is running in Script Editor, Script Debugger or from the inDesign script palette. It only occurs when run as an application. Does this mean that the styles I use in editing a script have an impact on the memory available when the script is running but the script's text and all its styles are not even visible?
>>Chris Nebel>>The other possibility (rather less likely, but plausible) is that you're running out of garbage-collected heap memory, which is where your script and all its "live" data while it's executing goes. "Running out", in this case, is an artificial construct -- there's a fixed maximum that you're not allowed to exceed. By default, this is 32MB; you can change it by adding an 'scsz' resource to the application running the script. (Instructions available on request.)
This is a large script that works on large files, but I don't think we're anywhere near 32MB, unless the script is retaining data from previous runs outside its properties and globals. Is that possible? Is that what the garbage-collected heap memory is?
I agree, "style runs" is the most likely suspect. Would using load script avoid this? I'm thinking I could load the handler that does the text filtering as a script and call that, would the loaded script generate the same error?
>>Mark Aldritt (via Stan Cleveland)>>then there is the AppleScript load script command. The downside of this is that SD cannot debug into loaded code.
Back in the good old days of using Scripter I did this:
--------
If not debugging then
set loadedScript to load script foo
end if
--more commands go here
if debugging then
tell application "Scripter(R)"
--Scripter should be running
--and the script foo should be
--open in the front window
--with 'listening' on
HandlerInLoadedScript(bar)
end tell
else
tell loadedScript
handlerInLoadedScript(bar)
end tell
end if
-------
With this setup I could step through the loaded script in Scripter.
Is this possible in Script Debugger? It looks like it can be set up to send appleEvents to the script window, but I haven't tried it yet, has anyone else?
Thanks everyone who replied!
ES
_______________________________________________
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