[cfe-dev] Memory leak analysis and self destructing objects
devlists at shadowlab.org
Wed Jul 23 18:20:14 CDT 2008
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 object
> 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.
More information about the cfe-dev