[cfe-dev] Memory leak analysis and self destructing objects
kremenek at apple.com
Wed Jul 23 16:23:10 PDT 2008
On Jul 23, 2008, at 4:20 PM, Jean-Daniel Dupas wrote:
> Le 23 juil. 08 à 18:19, Ted Kremenek a écrit :
>> On Jun 20, 2008, at 1:42 AM, Nikita Zhuk wrote:
>>> For example:
>>> NSWindow *window = [[NSWindow alloc]
>>> styleMask:NSTitledWindowMask|NSClosableWindowMask backing:
>>> NSBackingStoreBuffered defer:NO]; // isReleasedWhenClosed is set to
>>> YES by default
>>> [window orderFrontRegardless];
>>> // False memory leak reported - window will be released when user
>>> closes it
>> I'm reopened this issue as a new Bugzilla report:
>> It turns out that an NSWindow object doesn't self-own itself until it
>> is displayed, so the code snippet above is actually a real leak.
>> Right now the analyzer has been tweaked to consider an NSWindow
>> to be self-owning once it is initialized, but this is not correct.
>> The bugzilla report has more information.
> -orderFrontRegardless is a method that displays the window, so no,
> this code snippet is not a leak.
Thanks Jean-Daniel. I had missed that method call when I glanced over
the code. The analyzer still doesn't handle NSWindow properly.
More information about the cfe-dev