Bug 15945 - ImageViewer: showing large images can lead to out of memory situations
: ImageViewer: showing large images can lead to out of memory situations
Status: RESOLVED WONTFIX
Product: SqueezePlay
Classification: Unclassified
Component: Screensavers
: 7.5.x
: Macintosh Debian Linux
: P2 normal (vote)
: Investigating
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-24 06:52 UTC by Michael Herger
Modified: 2016-11-27 21:01 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
trigger forced garbage collection after an image has been rendered (1.73 KB, patch)
2010-03-24 06:53 UTC, Michael Herger
Details | Diff
force garbage collection after image has been rendered (791 bytes, patch)
2010-03-24 06:55 UTC, Michael Herger
Details | Diff
File causing massive memory consumption (1018.21 KB, image/jpeg)
2010-03-25 01:03 UTC, Michael Herger
Details
Mickey's log file from his oom crash (156.66 KB, text/plain)
2010-04-01 03:00 UTC, Michael Herger
Details
Photo 1 from bug 15977 (1.77 MB, image/jpeg)
2010-04-01 07:41 UTC, Mickey Gee
Details
Photo 2 from bug 15977 (516.37 KB, image/jpeg)
2010-04-01 07:41 UTC, Mickey Gee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Herger 2010-03-24 06:52:26 UTC
I've encountered situtations where fab4 would have killed embedded SBS while the ImageViewer screensaver was running. This mostly happened with large pictures (photos, 6 megapixels and more), when the interval was set to some short value. It seems the garbage collection didn't have time to clean up the memory in between image retrieval/resizing, leading to out of memory situations.

Forcing garbage collection whenever an image has been rendered seems to improve memory usage. While there are still spikes when the image is loaded, the memory is quickly freed, bringing the level down to normal load. Without the immediate GC fab4 might run out of memory trying to resize the next image before the memory has been freed..
Comment 1 Michael Herger 2010-03-24 06:53:20 UTC
Created attachment 6693 [details]
trigger forced garbage collection after an image has been rendered
Comment 2 Michael Herger 2010-03-24 06:55:22 UTC
Created attachment 6694 [details]
force garbage collection after image has been rendered

previous patch included other (unrelated) changes
Comment 3 Michael Herger 2010-03-24 23:02:29 UTC
FWIW: it took longer with this patch applied, but eventually crashed all the same.
Comment 4 SVN Bot 2010-03-24 23:34:45 UTC
 == Auto-comment from SVN commit #8667 to the jive repo by mherger ==
 == https://svn.slimdevices.com/jive?view=revision&revision=8667 ==

Bug: 15945
Description: don't zoom image unless needed
Comment 5 Michael Herger 2010-03-25 01:03:15 UTC
Created attachment 6697 [details]
File causing massive memory consumption

Further investigation showed that the problem described is limited to _some_ images. Attached is a sample file which will cause a memory consumption of >10MB when loading using Surface::loadImage(). Obviously the underlying code isn't able to only get a subsample of the jpg data. Interestingly the same file doesn't have EXIF and other headers neither. Unfortunately I can't remember how I created it.

I ran another test on an SD card full of 10/14 megapixel pictures (directly from the camera), and I didn't see any of the spikes as seen with the above much smaller sample file.
Comment 6 Michael Herger 2010-03-25 02:44:18 UTC
The problem I'm seeing is due to the images being saved as progressive JPEG. If I take the same file and save it without the progressive flag, it would load easily without the additional overhead. I didn't find any reference to this being an issue on the internet, but I've seen it with all my progressive JPEG files.

The bottom line probably is: we're tight on memory. Image handling requires a lot of it. Thus we're prone to problems in this area. I'd expect the same or similar issues with anything else than jpg, as afaik only jpg offers the optimized scaling.

The good news is: most people probably will use their images as taken with their camera. No fancy progressive encoding used, jpg only.

Some help with garbage collection might still be good, though expensive. I'll run a few more tests with it to see whether it would negatively influence playback.
Comment 7 Michael Herger 2010-04-01 02:59:37 UTC
*** Bug 15977 has been marked as a duplicate of this bug. ***
Comment 8 Michael Herger 2010-04-01 03:00:38 UTC
Created attachment 6730 [details]
Mickey's log file from his oom crash
Comment 9 Mickey Gee 2010-04-01 07:41:23 UTC
Created attachment 6733 [details]
Photo 1 from bug 15977
Comment 10 Mickey Gee 2010-04-01 07:41:56 UTC
Created attachment 6734 [details]
Photo 2 from bug 15977
Comment 11 Mickey Gee 2010-04-01 07:43:26 UTC
Comment on attachment 6734 [details]
Photo 2 from bug 15977

I used Nikon Capture 4.3 software to resize. Original probably 4-6MB.
Comment 12 Michael Herger 2010-04-01 09:32:58 UTC
Pictures look fine if fab4 is given enough time to do the garbage collection. What image change interval are you using?
Comment 13 Michael Herger 2011-01-13 03:13:33 UTC
Andy - do you know whether your new resizing code would improve the behaviour with progressive JPGs?
Comment 14 Andy Grundman 2011-01-13 06:12:57 UTC
No, progressive JPEGs are evil, my resizing code can be set to ignore them because they waste so much memory.  We should just skip or display an error message for prog JPEGs.
Comment 15 Michael Herger 2011-01-17 04:27:39 UTC
How would I be able to get that piece of information from the Lua side of SP?
Comment 16 SVN Bot 2011-09-09 06:55:23 UTC
 == Auto-comment from SVN commit #9507 to the jive repo by mherger ==
 == http://svn.slimdevices.com/jive?view=revision&revision=9507 ==

Bug: 15945
Description: force garbage collection when slideshow is running. Resizing larger images might cause memory issues.