GNOME Bugzilla – Bug 667258
evince cb7 memory leak
Last modified: 2012-03-14 16:32:29 UTC
1) Archive a set of images to a .7z file. 2) Add to (or rename) the extension to .cb7. 3) Open the .cb7 file with Evince. *) Leak, leak leak... (Report opened from message to the mailing list.)
Which evince version is this about? Can you provide a testcase?
Created attachment 204693 [details] testcase for the memory leak As I tried to explain in my first comment, this is not my bug, but the one described (and not reported here, AFAIK) at https://mail.gnome.org/archives/evince-list/2012-January/msg00006.html.
The original reporter added the following information in the mailing list: System: Salix OS 13.37 Evince: 2.32.0 Evince consumes ~40 MB (RAM) while it will consume ~20 MB viewing the same set of image files in .zip (.cbz) archive. As a matter of fact, in my system, Evince will always consume around ~20 MB of RAM whether it is this small eleven (11) simple images archive or thirty (30) pages of higher quality images (this is when the .cb7 is getting to 100, 200, 300 MB of RAM consumption levels). https://mail.gnome.org/archives/evince-list/2012-January/msg00011.html https://mail.gnome.org/archives/evince-list/2012-January/msg00012.html
I've found several leaks and write a quick patch. I'll submit the patch after auto-reviewing of my patch :-)
Created attachment 205316 [details] [review] Fix some memory leaks
Review of attachment 205316 [details] [review]: Thanks, see my comments below. ::: backend/comics/comics-document.c @@ +643,3 @@ + *width = gdk_pixbuf_get_width (pixbuf); + if (height) + *height = gdk_pixbuf_get_height (pixbuf); Call g_object_unref here, see below. @@ +648,2 @@ } + if G_IS_OBJECT (pixbuf) g_object_unref (pixbuf); gdk_pixbuf_loader_get_pixbuf() is transfer-none, so this is wrong when pixbuf was get from the loader. @@ +722,3 @@ + rotated_pixbuf = + gdk_pixbuf_rotate_simple (tmp_pixbuf, + 360 - rc->rotation); Unref the pixbuf here. @@ +726,2 @@ } + if G_IS_OBJECT (tmp_pixbuf) g_object_unref (tmp_pixbuf); Same here, this is wrong when tmp_pixbuf was returned by the loader.
Created attachment 205415 [details] [review] Patch corrected Thanks Carlos for the review. I wasn't aware about the "transfer-none" thing :-) Let's see if this one is good enough
Review of attachment 205415 [details] [review]: Thanks!
Juanjo: Can you commit this?
Patch applied to master and gnome-3-2 branches I intended to push only to master branch. I never push it before, and I've released I pushed also to push it to the gnome-3-2 branch, I hope there isn't any problem with that (the patch works ok in both branches)