• 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: Odd memory issue -- not a newbie
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Odd memory issue -- not a newbie


  • Subject: Re: Odd memory issue -- not a newbie
  • From: Dietrich Epp <email@hidden>
  • Date: Mon, 15 Dec 2003 13:45:10 -0800

On Dec 14, 2003, at 6:56 PM, Jonathan Jackel wrote:

I know you are trying to help, and I thank you for trying, but you've made a some errors (one of them serious) here that I don't want to let go uncorrected. Sorry if this sounds a little bitchy, but ...

Geez, sorry. All I can say is that my guess is that you are getting a subclass, and you don't want it, and when you create a new object you don't have the subclass any more.

Why would "getting a subclass" make any difference at all? All classes are supposed to obey the same memory management rules and are not supposed to dealloc until the last retain is matched by a release.

Like some private subclass tied to a buffer somewhere, that can't last beyond a certain scope. Never mind, it was a wild guess. Have you tried using the object allocation debugging? Have you tried looking at messages sent to your object? I might, if all else fails, 1) set a watchpoint on the pointer so I know it isn't changing, and 2) breaking on -[whatever release] and -[whatever retain]. You've given us a good start with code that you can change and break the program, but I don't have your terminal in front of me and I don't even know what calls your function.

This is does exactly the same thing as my code which, if you will recall, was

[newValue retain];
[value release];
value = newValue;

The only difference is in the order of things, and you use an extra variable. So what?

I was being clumsy the second time, and this is getting a bit off topic, but...

[value release];
value = [newvalue retain];

This should work anyway. Something else has to have at least a temporary reference to the object in order to pass it to the method. Accessors do the retain-autorelease jig.

Finally, are you sure that alloc-init is unmanageably slow? First rule of optimization: don't. _______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Odd memory issue -- not a newbie (From: Jonathan Jackel <email@hidden>)
 >Re: Odd memory issue -- not a newbie (From: Dietrich Epp <email@hidden>)
 >Re: Odd memory issue -- not a newbie (From: Dietrich Epp <email@hidden>)
 >Re: Odd memory issue -- not a newbie (From: Jonathan Jackel <email@hidden>)

  • Prev by Date: Re: NSLocalizedString fails rarely?
  • Next by Date: Re: 'WebKit/WebKit.h' not found
  • Previous by thread: Re: Odd memory issue -- not a newbie
  • Next by thread: Re: Odd memory issue -- not a newbie
  • Index(es):
    • Date
    • Thread