Hi Everyone I am trying to create PNG(thumbnail) images from the pdf for my app for that i used couple of answers from the stackoverflow below code is i am using `-
A loop for thousand pages means you alloc memory for each page process and that chunk of memory is never reused until method ends. Obj-C memory management works that way, with an effective release of memory after each loop.
If you want to reuse memory for each iteration, use an independent NSAutoreleasePool
for(int i = 0; i < totalNum; i++ ) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
... .... (process page ... ) ...
[pool release];
}
Or, in the case you are using ARC:
for(int i = 0; i < totalNum; i++) {
@autoreleasePool {
.... (... process page ... ) ....
}
}
Check out this open source project; they're doing quite a good job of rending the PDF into a UIImage. https://github.com/mindbrix/UIImage-PDF