Re: static objects "autoreleased with no pool in place - just leaking"
Re: static objects "autoreleased with no pool in place - just leaking"
- Subject: Re: static objects "autoreleased with no pool in place - just leaking"
- From: j o a r <email@hidden>
- Date: Fri, 13 Feb 2004 09:06:35 +0100
If something hurts, then you should stop doing it... There is more than
one way to skin a cat, as they say.
Have a look at my last reply for an alternative solution on this topic.
Using +initialize is another place where you could initialize static
variables - but I wouldn't suggest that you use it unless you're
completely aware of the potential pitfalls with using that method. More
information on that can be found in the documentation, and of course
the list archives.
j o a r
On 2004-02-13, at 09.02, m wrote:
>
It happens just as the instances are allocated. But you can see for
>
your self!
>
>
- in XCode, create a non-document Cocoa app.
>
- open main.m and paste the code below into it
>
- save main.m as main.mm (note the double-m extension)
>
- compile and run while watching the console window
>
>
You should see
>
>
...class NSDeviceRGBColor autoreleased with no pool in place - just
>
leaking
>
>
// -------------------------------------------------------
>
// main.mm
>
>
#import <Cocoa/Cocoa.h>
>
>
static NSColor* sDefaultLabelColor = [NSColor colorWithDeviceRed: 0.0
>
green:0.0 blue:0.0 alpha:1.0];
>
>
int main(int argc, const char *argv[])
>
{
>
return NSApplicationMain(argc, argv);
>
}
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.