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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com