Comment 3 for bug 1470109

Revision history for this message
Michi Henning (michihenning) wrote :

I suspect that there are two issues here. Both need to be addressed, but in the right order.

The first problem (I think) is that the gallery app may be asking for more than it can eat. If the thumbnailer gets, say, 1000 requests for thumbnails, once the cache is hot, it'll deliver all the thumbnails very quickly. It should take about 1-1.5 seconds to return 1000 thumbnails on a Nexus 4. If the renderer cannot keep up, all those thumbnails pile up in memory and, by looks of things, gallery app falls over for lack of memory.

The second problem is that many of the requests have QSize(-1,-1). In response, the thumbnailer delivers 1920 sized thumbnails for photos and videos. Of course, that eats tons of extra memory and also makes the renderer work even harder, slowing things down further, which causes the memory starvation to mushroom out of control.

Asking for thumbnails in the correct size is necessary and will probably make the problem disappear. BUT: the underlying real problem seems to be that the gallery app asks for more than it can eat. So, even with thumbnails of the correct size, I think the memory pile-up issue could potentially persist. So, before addressing problem 2, it might be a good idea to look at problem 1 and check whether an "unreasonably" large number of requests can be issued to the thumbnailer. If so, limiting the amount of data the gallery app asks for would attack the root problem, I believe.

Once the root problem is solved, asking for thumbnails in the correct size will make a big difference to the user experience, to battery life, and to the hit rate on the cache. So both problems are worth solving.