Debugging retainCount
Debugging retainCount
- Subject: Debugging retainCount
- From: The Amazing Llama <email@hidden>
- Date: Mon, 14 Jul 2003 19:56:46 -0700
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.