Applescript: force garbage collection? (NSAppleScript call from Cocoa app)
Applescript: force garbage collection? (NSAppleScript call from Cocoa app)
- Subject: Applescript: force garbage collection? (NSAppleScript call from Cocoa app)
- From: eveningnick eveningnick <email@hidden>
- Date: Tue, 14 Sep 2010 03:05:03 +0300
Hello
I am trying to call applescript functions (from my cocoa application - using
NSAppleScript's -executeAndReturnError), to automate some operations in
Microsoft Word.
The problem is that after every Applescript call, the Word operates slower
and slower (and i guess finally it won't respond at all). I am calling
operations, like "set myvar to all words of current document whose some
conditional" or "set myvar to all fields of current document whose some
conditional" (which are memory consuming - on each call Word enumerates all
the words of a long document, searches there some matches, etc), and i think
that after each call of NSAppleScript's -executeAndReturnError, Word doesn't
clean its previous "results", which slows it down with every next call. I
wanted to try to do an explicit call of Applescript's garbage collector
after each -executeAndReturnError from my Cocoa app, maybe that could
eliminate the problem i have.
But i didn't find any info on how to do that. Java, ActionScript - most
garbage collectors have System.gc() functions (that launch Garbage
collection if it's needed right here and right now). If theres no way to
force garbage collecting in AppleScript, maybe someone knows "implicit
ways", when AppleScript engine calls it? Like the next iteration of a loop,
or some other conditions? Or some timespan, after passing which the GC is
called?
What could cause that slowness of Mac:Word? Is it a mistake of Microsoft, or
am i forgetting to do something? If someone could advice readings about how
applications usually implement Applescript interface "from the inside" (and
who is responsible for cleaning the results of each call), i'd be very
thankful.
Thanks for any advice!
George
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden