Search code examples
iosobjective-cmemoryuiimage

Saving images more efficiently in favor of minimum memory use


I'm observing the Pasteboard for changes, that include images. The amount of memory I can use is limited, so most images make the program result in a jetsam crash due to their size. Is it possible to store them more efficiently?

Currently I'm using this code to store them:

for (UIImage* image in [_pasteboard images]) {
    [UIImagePNGRepresentation(image) writeToFile:path atomically:YES];
}

Solution

  • I solved it by making a different process with more memory do the work. The original process only sends a notification now.