Re: finding memory leaks
Re: finding memory leaks
- Subject: Re: finding memory leaks
- From: Torsten Curdt <email@hidden>
- Date: Tue, 12 Feb 2008 20:23:26 +0100
On 11.02.2008, at 15:45, Brian Christensen wrote:
On Feb 11, 2008, at 09:25, Torsten Curdt wrote:
For this snippet there is nothing that should live on after the
blocks has finished. So no "retain" and things should be quite
straight forward. With the NSAutoreleasePool I just find it hard
to find out what needs to the "autorelease"'d and what not.
("alloc", "new" etc are already covered - I know) But somehow I am
still failing according to "leaks".
It looks like you're leaking leaking your "queries" NSMutableArray.
The autorelease pool you established is only responsible for
cleaning up autoreleased objects, so you need to add in a "[queries
release]" statement somewhere (or use "queries = [NSMutableArray
array]" instead).
You also shouldn't be autoreleasing the result of the
"searchElementForProperty" messages. This method is (by convention)
already returning an autoreleased object.
Thanks, Brian! That fixed it. I think I need to do a bit more
homework in this area.
cheers
--
Torsten
_______________________________________________
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