Re: -[NSView dataWithPDFInsideRect:] leaks
Re: -[NSView dataWithPDFInsideRect:] leaks
- Subject: Re: -[NSView dataWithPDFInsideRect:] leaks
- From: "Erik M. Buck" <email@hidden>
- Date: Thu, 18 Apr 2002 16:26:24 -0500
I assume that you are calling your code in a loop. The autoreleased pdfData
never does not get dealloacted until the aurorelease pool gets dealocated.
Solve the problem by creating your own local autorelease pool.
I added code to your example in email so there may be typos.
>
if ([[self window] isMiniaturized]) {
>
NSImage* anImage;
>
NSData* pdfData;
// create a local pool
NSAutoreleasePool *localPool = [[NSAutoreleasePool
alloc] init];;
>
// get the desired image
>
pdfData = [plotView dataWithPDFInsideRect:[plotView
bounds]];
>
anImage = [[NSImage alloc] initWithData:pdfData];
>
[[self window] setMiniwindowImage:anImage];
>
[anImage release];
[localPool release]; // releases all autoreased
objects including pdfData
>
}
_______________________________________________
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.