discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory leak


From: Chris Vetter
Subject: Re: memory leak
Date: Wed, 29 Nov 2006 22:12:01 +0100
User-agent: GNUMail (Version 1.2.0)

On 2006-11-29 18:55:15 +0100 Marc Brünink <mbruen@smartsoft.de> wrote:
> today I discovered a memory leak in one of our frameworks. I searched till I 
> went mad, but didn't find anything.
> Has anyone a suggestion how to track this one down?

The easiest way would be to replace NSObject's -init and -dealloc methods. The 
replacement of -init would then create a counter object (if it doesn't exist 
yet) when ever it is called, and increment it by one, then return the original 
-init. The new -dealloc would just decrement the object counter by one, then 
call the original -dealloc. To check, you would have to first swizzle the 
original -init and -dealloc with the new ones, run your test, dump the counter 
when its finished, then switch both methods back to the original.

Yes, it's a hackish way, but it works.

-- 
Chris






reply via email to

[Prev in Thread] Current Thread [Next in Thread]