Re: need help understanding and learning memory managment..
Re: need help understanding and learning memory managment..
- Subject: Re: need help understanding and learning memory managment..
- From: glenn andreas <email@hidden>
- Date: Wed, 31 Aug 2005 14:05:55 -0500
On Aug 31, 2005, at 12:44 PM, Eric Morand wrote:
Le 31 août 05 à 19:35, Brian O'Brien a écrit :
For one thing is it possible to print out the current retain
counter of an object?
Just for some debugging purpose?
- (unsigned)retainCount does this ! This is an instance method of
NSObject.
Be aware that you really shouldn't pay attention the results given by
retainCount, since there is often a great deal of behind the scenes
retaining going on, and so the values you see may not be at all what
you expect.
Simply using a variable as a parameter to another method can cause
that retain count to go up (and possibly cause other variables retain
counts to go down).
For example
foo1 = ... some object
foo2 = ... some other object
[x doSomething: foo1];
// at this point, foo1 may be +1, or maybe not
[x doSomethingElse: foo2];
// at this point, foo2 may be +1, and foo1 may even be -1, or
maybe not
As a result of these values changing in ways that are often non-
obvious, treat any conclusions drawn from the values of retainCount
(or the delta of those values) with a grain of salt.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | build, mutate, evolve | images, textures, backgrounds, art
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden