Re: Trouble with property (copy) and retain counts

2009-05-06 Thread mmalc Crawford
On May 5, 2009, at 4:04 PM, Malayil George wrote: I don't think I have a leak...quite the opposite. I think the sample app I'm playing with is crashing because I might be releasing an object too soon. Which is why I resorted to retainCounts to try and track it down...

Re: Trouble with property (copy) and retain counts

2009-05-06 Thread Jean-Daniel Dupas
Search NSZombie in Google. It may be what you need. Le 6 mai 09 à 01:04, Malayil George a écrit : I don't think I have a leak...quite the opposite. I think the sample app I'm playing with is crashing because I might be releasing an object too soon. Which is why I resorted to retainCounts to

Re: Trouble with property (copy) and retain counts

2009-05-05 Thread Stephen J. Butler
Beyond the fact that retain counts are useless for debugging... On Tue, May 5, 2009 at 5:54 PM, Malayil George wrote: > NSLog(@"Cell image pointer: %x, retain count: %d", [cell image], [[cell > image] retainCount]); //retain count 4 > > NSLog(@"Cell image pointer: %x, retain count: %d", [cell ima

Re: Trouble with property (copy) and retain counts

2009-05-05 Thread Nick Zitzmann
On May 5, 2009, at 5:04 PM, Malayil George wrote: I don't think I have a leak...quite the opposite. I think the sample app I'm playing with is crashing because I might be releasing an object too soon. Which is why I resorted to retainCounts to try and track it down... You can track that

Re: Trouble with property (copy) and retain counts

2009-05-05 Thread Malayil George
I don't think I have a leak...quite the opposite. I think the sample app I'm playing with is crashing because I might be releasing an object too soon. Which is why I resorted to retainCounts to try and track it down... George On Tue, May 5, 2009 at 7:01 PM, Nick Zitzmann wrote: > > On May 5, 2

Re: Trouble with property (copy) and retain counts

2009-05-05 Thread Nick Zitzmann
On May 5, 2009, at 4:54 PM, Malayil George wrote: If the getter is always incrementing the reference count by 1, I would expect the reference count at each NSLog, where I am using the getter, to be 2 above the previous value. This doesn't seem to be the case for line 3 of the output where i

Re: Trouble with property (copy) and retain counts

2009-05-05 Thread Malayil George
Hi, Thanks for the replies. Things are a bit clearer now, that I understand the synthesized getters are returning retained and auto-released objects. However, the behavior doesn't seem to be entirely consistent. I have marked in comments below what I would expect the retain count to be

Re: Trouble with property (copy) and retain counts

2009-05-05 Thread Jean-Daniel Dupas
If the retain count confuses you, you stop to using it as it's almost never relevant. That said, have a look at the atomic section in the property references: http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocProperties.html Le 5 mai 09 à 06:34, Malayil George

Trouble with property (copy) and retain counts

2009-05-05 Thread Malayil George
Hi,I'm a little confused with retain counts and properties. I would appreciate some help in understanding this. I have a class setup as follows @interface Cell : NSObject { NSImage *image; } @property (copy) NSImage *image; @end Now, in my code, I do the following NSImage *img = [[NSIm