Re: Applescript: force garbage collection? (NSAppleScript call from Cocoa app)
Re: Applescript: force garbage collection? (NSAppleScript call from Cocoa app)
- Subject: Re: Applescript: force garbage collection? (NSAppleScript call from Cocoa app)
- From: John Nairn <email@hidden>
- Date: Tue, 14 Sep 2010 13:17:18 -0700
On Sep 14, 2010, at 10:24 AM, email@hidden wrote:
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.
I have always assumed that creating an NSAppleScript, compiling,
executing, and then releasing the object will clear out memory as much
as you can from your code. Thus it seems the problem must be in the MS
Word methods that are triggered by the script. Unless MS Word has a
method to clear its memory, I don't see much hope. The memory problem
is probably an MS Word bug where some command handler fails to release
memory when done.
I run scripts often that take data from my application and output them
in a Word document and have never noticed slow down in Word (but have
not tested using Word after scripts very often). It might be just one
scripting command in Word that has the problem, which in principle
could be diagnosed by test scripts (if your are willing to go through
the several hundred page scripting dictionary). I found the MS Word
scripting dictionary hard to follow. Many things that "should" work
don't work as expected. It took me a long time to get useful scripts
that interact with Word (although it is possible).
------------
John Nairn
http://www.geditcom.com
Genealogy Software for the Mac
_______________________________________________
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