I am creating an application which is a kind of gallery - it shows different media content as a fullscreen viewer. Allocations instrument shows that Live Bytes parameter doesn't grow higher than 40 Mb when using application. Meanwhile the app is 100% being killed after I slide pages 20-30 times. I checked Dirty Memory parameter and found it was 10 times bigger than Live Bytes size. And the most of that dirty memory consumed Image IO:
EDIT, another screenshot:
The allocations peaks above are switching video/image media contents. The problem is the dirty memory grows almost linearly and I need to release it somehow.
Now about application design. Application screen has one horizontal scroll view. Scroll view contains videos or collage objects which contain multiple images. To save memory only three pages are created at a time - current page and pages on the left/right. So pages always created and removed on-fly when sliding scroll view.
All the images I load using [UIImage imageWithContentOfFile: path]
method.
Collage object stores UIImage instances inside imagesArray. In dealloc method imagesArray attribute is cleared.
So, questions:
- Is it a kind of system bug in
[UIImage imageWithContentOfFile?]
- Is it Image IO cache?
- Can I clear it?