NSPDFImageRep Memory Leak?
NSPDFImageRep Memory Leak?
- Subject: NSPDFImageRep Memory Leak?
- From: DairyKnight <email@hidden>
- Date: Tue, 8 Sep 2009 20:08:16 +0800
Hi all,
I'm trying to rasterize a PDF document using PDFKit, but it seems NSPDFImageRep
has a terrible memory leak, which
crashes my whole application. This is the simple test code I used:
for (int i = 0; i < [pdfDoc pageCount]; i++)
{
NSLog(@"Processing page %d/%d", i, [pdfDoc pageCount]);
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
PDFPage *page = [pdfDoc pageAtIndex:i];
NSRect mb = [page boundsForBox:kPDFDisplayBoxMediaBox];
NSRect cb = CalcCropBox(mb, 40, 60, 18, 18);
[page setBounds:cb forBox:kPDFDisplayBoxMediaBox];
NSPDFImageRep *pdfImgRep = [[NSPDFImageRep alloc] initWithData:[page
dataRepresentation]];
[pdfImgRep release];
[localPool drain];
}
In the code, pdfDoc is a preloaded PDFDocument object. As seen from above,
I've released everything allocated, but in Instruments, this app keeps on
consuming memory.
So is this a bug in PDFKit? Or I'm not supposed to use it in this way?
Thanks.
Regards
Dairyknight
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden