memory leak when JPEG, not when PNG

632 views Asked by At

My application aims at saving some user photos in a PDF file in order to send the file by email. To produce a small size pdf, I want to compress my images in jpeg. When I draw jpeg to the PDF context, the pdf file is indeed much smaller than when I use PNG, but the use of JPEG leaks.

For my debugging I added a jpeg and a png file to my project.

The following call leaks :

UIImage * destImage = [UIImage imageNamed:@"Image.JPG"];
[destImage drawInRect:drawingFrame];

whereas this one does not :

UIImage * destImage = [UIImage imageNamed:@"Image.png"];
[destImage drawInRect:drawingFrame];

Is there something I'm missing ? Is it a know issue ?

I'm thinking about a workaround that would consist in using a PNG representations of my images and set a specific compression option to the pdf I generate, but did not find this in the pdf generation sdk.

Do you have an idea about it ? Thanks in advance.

0

There are 0 answers