Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OSALoad and leaking handle



>Micah,
>
>In your example, I don't see where the script resource is being disposed,
>but I'm going to assume that the StResource class instance takes care of
>that.

Yes, it does. And StAEDescriptor handles the dealings of an AEDesc,
disposing of it when the StAEDescriptor goes out of scope.

>Your sample code doesn't show how you are actually loading and unloading
>the script in the AppleScript component (OSALoad & OSADispose). If you
>are disposing the ScriptID before releasing the component instnace this
>could very well be a leak in AppleScript itself.
>
>andy b

A very simple use would be:
{
ASLoader theAS(someFileSpec);
theAS.LoadScript();
}

At the end of the block theAS goes out of scope and its destructor is
called, thus releasing the ScriptID and then component instance as
necessary. If I leave out the call to LoadScript() then no handles leaked.
If I call it in a loop I get one leak per call to LoadScript(). I'm just
trying to double check that I'm not overlooking something before I assume
AppleScript is the problem. Thanks,
Micah


References: 
 >Re: OSALoad and leaking handle (From: Andy Bachorski <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.