Skip navigation.
 
mlRe: finding memory leaks
FROM : Torsten Curdt
DATE : Tue Feb 12 20:23:26 2008

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

Related mailsAuthorDate
mlfinding memory leaks Torsten Curdt Feb 11, 15:25
mlRe: finding memory leaks Brian Christensen Feb 11, 15:45
mlRe: finding memory leaks Torsten Curdt Feb 12, 20:23