Re: Odd memory issue -- not a newbie
Re: Odd memory issue -- not a newbie
- Subject: Re: Odd memory issue -- not a newbie
- From: Jonathan Jackel <email@hidden>
- Date: Sun, 14 Dec 2003 21:56:22 -0500
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.
Or there is an extra release somewhere else.
That's my suspicion. It's not in my code because there is only one
release in my code and it's in dealloc. I sort of suspect that one of
the objects in the text architecture (NSTextStorage, NSTextContainer,
NSLayoutManager, or NSTextView) isn't behaving, but the far more likely
possibility is that I don't quite understand them. Does anybody?
I didn't look up the documentation because it didn't look terribly
specific to whatever class you were using, and I usually would do
foo* oldvalue = value
value = [newvalue retain]
[oldvalue release]
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?
instead anyway, but I didn't want to clutter and my personal coding
style is to try and code the least amount that works even if it
crashes sometimes (not a place to discuss this).
Yeah, let's not get into that here.
Could you give more specifics? Have you tried debugging and printing
out what the values of your new object are, its class, etc?
I've tried debugging. The values are what you would expect, and
printing wouldn't work if they weren't.
Jonathan
_______________________________________________
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.