Re: Debugging retainCount
Re: Debugging retainCount
- Subject: Re: Debugging retainCount
- From: Jeff Harrell <email@hidden>
- Date: Mon, 14 Jul 2003 22:32:30 -0500
I've always kind of been of the opinion that releasing an already freed
object ought to be a non-fatal error, myself. But I'm sure there are
lots of good arguments on both side of that issue.
On Monday, July 14, 2003, at 09:56 PM, The Amazing Llama wrote:
I had a memory leak in my program where I was autoreleasing too often
(which is the memory leak I always seem to have), and I think I've
figured out a simple way to track these things down.
Why couldn't NSObject be enhanced so that every time it gets an
-autorelease message, it increments a counter. It then checks this
counter against it's retainCount and debugger-breaks if the pending
autoreleases are greater than the retains.
I could do this myself with a poseAs: but I don't know how to
decrement the counter on getting a release from the autorelease pool.
I suppose you could check the stack, but that seems a little hackish.
However, this would make a very nice, very simple addition to the
frameworks, but making the NSAutoreleasePool decrement the counter
before calling -release.
Unless (as I probably am) I am overlooking something simple that makes
all this impossible. Would this work?
Seth A. Roby The Amazing Llama < mail or AIM me at tallama at mac
dot com>
"Life is like an exploded clown. It's really funny until you figure
out what just happened."
_______________________________________________
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.
--
email@hidden
http://homepage.mac.com/jharrell
_______________________________________________
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.