• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: finding memory leaks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >finding memory leaks (From: Torsten Curdt <email@hidden>)
 >Re: finding memory leaks (From: Brian Christensen <email@hidden>)

  • Prev by Date: Re: Repetitive Appending of Strings
  • Next by Date: Re: Event Tap strangeness
  • Previous by thread: Re: finding memory leaks
  • Next by thread: layoutManager:didCompleteLayoutForTextContainer:atEnd: returns atEnd as NO dodgily for me (but works in TextEdit...)
  • Index(es):
    • Date
    • Thread