After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 667258 - evince cb7 memory leak
evince cb7 memory leak
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: backends
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-04 13:54 UTC by Pablo Rodríguez
Modified: 2012-03-14 16:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase for the memory leak (103.50 KB, application/x-cb7)
2012-01-05 15:45 UTC, Pablo Rodríguez
  Details
Fix some memory leaks (3.05 KB, patch)
2012-01-15 22:21 UTC, Juanjo Marín
needs-work Details | Review
Patch corrected (2.99 KB, patch)
2012-01-16 22:13 UTC, Juanjo Marín
committed Details | Review

Description Pablo Rodríguez 2012-01-04 13:54:45 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.)
Comment 1 André Klapper 2012-01-04 14:23:15 UTC
Which evince version is this about?
Can you provide a testcase?
Comment 2 Pablo Rodríguez 2012-01-05 15:45:44 UTC
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.
Comment 3 Juanjo Marín 2012-01-08 11:11:41 UTC
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
Comment 4 Juanjo Marín 2012-01-08 23:43:34 UTC
I've found several leaks and write a quick patch. I'll submit the patch after auto-reviewing of my patch :-)
Comment 5 Juanjo Marín 2012-01-15 22:21:56 UTC
Created attachment 205316 [details] [review]
Fix some memory leaks
Comment 6 Carlos Garcia Campos 2012-01-16 10:42:17 UTC
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.
Comment 7 Juanjo Marín 2012-01-16 22:13:02 UTC
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
Comment 8 Carlos Garcia Campos 2012-01-20 14:26:20 UTC
Review of attachment 205415 [details] [review]:

Thanks!
Comment 9 André Klapper 2012-01-29 13:48:28 UTC
Juanjo: Can you commit this?
Comment 10 Juanjo Marín 2012-01-29 21:08:24 UTC
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)