• 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: Instruments leaks.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instruments leaks.


  • Subject: Re: Instruments leaks.
  • From: Sandro Noel <email@hidden>
  • Date: Sun, 12 Oct 2008 10:51:45 -0400

Joar, thank you for the clear explanation, it will help with my leak research.

Sandro.

On 12-Oct-08, at 1:07 AM, j o a r wrote:


On Oct 11, 2008, at 9:31 PM, Sandro Noel wrote:

for instance, the leek tells me that i have a leek here in this functions.


So this is actually not really true. What leaks will initially tell you is where the leaked object was created. That's not the same thing as where that object was leaked. Leaks can't tell you exactly where the object was leaked, unfortunately. What it can tell you though, is all the places where the object was retained & released (and autoreleased). Using this information, you can typically figure out where you retained some object when you shouldn't have, creating a leak.

Example:

	- (NSString *) giveMeAString {
		// String created here. No memory management error at this point.
		return [NSString stringWithString: @"A String"];
	}

- (void) someMethod {
NSString *aString = [self giveMeAString];
[aString retain]; // String retained here, but never subsequently released. This is a leak!
}


Notice how the string is created in one place, but how the actual memory management error that leaks that object happens elsewhere.


j o a r



_______________________________________________

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: 
 >Instruments leaks. (From: Sandro Noel <email@hidden>)
 >Re: Instruments leaks. (From: j o a r <email@hidden>)
 >Re: Instruments leaks. (From: Sandro Noel <email@hidden>)
 >Re: Instruments leaks. (From: j o a r <email@hidden>)
 >Re: Instruments leaks. (From: Sandro Noel <email@hidden>)
 >Re: Instruments leaks. (From: j o a r <email@hidden>)

  • Prev by Date: Re: Instruments leaks.
  • Next by Date: Re: Instruments leaks.
  • Previous by thread: Re: Instruments leaks.
  • Next by thread: Re: Instruments leaks.
  • Index(es):
    • Date
    • Thread