Re: NSTask memory leak
Re: NSTask memory leak
- Subject: Re: NSTask memory leak
- From: Stefan Werner <email@hidden>
- Date: Wed, 29 Nov 2006 19:19:28 +0100
On Nov 29, 2006, at 6:19 PM, Shawn Erickson wrote:
What you should do is ensure an autorelease pool is in place during
any method call that sends objective-c messages and released on exit
from such methods (note the that in a Cocoa application an autorelease
pool is managed for you on the main thread).
Well, I did try different patterns of creating/destroying the
autoreleasepools with no success so far, including creating/
destroying one per thread. Making it a member of the C++ class seemed
like the most convenient way, but I see now that this only works as
long as only one instance of that class exists at a time (which
actually is true in my case).
Any NSObject subclass
that you need to exist for the life of your C++ class must have either
an implicit retain (alloc, copy, etc.) or explicit retain on the
object. Then on destruction of the C++ is must balance that retain
with a release (or autorelease).
Given that my NSTask is created through alloc/init an later released
explicitly and all the other Cocoa objects in my C++ class are
autoreleased implicitly, I should be fine here, right?
Stefan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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