• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: -[NSView dataWithPDFInsideRect:] leaks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Porting a Win app to MAC 10 (From: Kaelin Colclasure <email@hidden>)
 >-[NSView dataWithPDFInsideRect:] leaks (From: Peter Sichel <email@hidden>)

  • Prev by Date: scrollPoint have no effect
  • Next by Date: How to make an NSTextField focused?
  • Previous by thread: -[NSView dataWithPDFInsideRect:] leaks
  • Next by thread: Re: -[NSView dataWithPDFInsideRect:] leaks
  • Index(es):
    • Date
    • Thread