GNOME Bugzilla – Bug 344731
gdk_pixbuf_animation_new_from_file eats up all my memory after open a GIF file
Last modified: 2014-10-22 14:23:51 UTC
Distribution: Debian testing/unstable
Version: GNOME2.14.2 2.14.x
Synopsis: eog eat up all my memory after open a GIF file
Bugzilla-Component: image viewer
Description of Problem:
eog eat up all my memory after open a GIF file
Steps to reproduce the problem:
1. launch eog
3. open msf-abbrev-demo.gif (you can get it from
the program eat up all my memory
open the picture file correctly
How often does this happen?
every time I open msf-abbrev-demo.gif
This is the gif file.
------- Bug created by bug-buddy at 2006-06-13 05:40 -------
sad but true
this also affects nautilus file preview
<nazgul> hmm what lib is used by eog and nautilus to show gif files
<bandini> nazgul, the gtk+ gif loader, I suppose
Should this bug not be reassigned to gtk and gdk-pixbuf?
Agreed, moving. Still present in GTK+ 2.10.
A relevant trace obtained from eog with valgrind shows:
==1425== 118,710,196 bytes in 146 blocks are still reachable in loss record 166 of 166
==1425== at 0x401D4B0: malloc (vg_replace_malloc.c:149)
==1425== by 0x4BC8DF3: g_try_malloc (gmem.c:196)
==1425== by 0x498FCED: gdk_pixbuf_new (gdk-pixbuf.c:269)
==1425== by 0x6D10B58: gif_get_lzw (io-gif.c:855)
==1425== by 0x6D11E2A: gif_main_loop (io-gif.c:1405)
==1425== by 0x6D1240F: gdk_pixbuf__gif_image_load_increment (io-gif.c:1581)
==1425== by 0x49960F5: gdk_pixbuf_loader_write (gdk-pixbuf-loader.c:466)
==1425== by 0x806CDAF: eog_image_real_load (eog-image.c:822)
==1425== by 0x806D3E5: eog_image_load (eog-image.c:998)
==1425== by 0x807B2EE: eog_job_load_run (eog-jobs.c:340)
==1425== by 0x8079DCB: handle_job (eog-job-queue.c:77)
==1425== by 0x807A034: eog_render_thread (eog-job-queue.c:140)
*** Bug 413619 has been marked as a duplicate of this bug. ***
From bug #413619:
"Opened by Sven Arvidsson (reporter, points: 13)
2007-03-01 21:01 UTC [reply]
When EOG opens or Nautilus thumbnails large animated GIF files, for example
screencasts created in Byzanz, very large amounts of memory is used, sometimes
the OOM-killer kicks in.
Example GIF: http://people.freedesktop.org/~company/byzanz/demo.gif
Possibly related to bug 142428, where some TIFF images eats RAM."
If eog uses a GdkPixbufLoader to load a gif, it is responsible for stopping after the first frame if it is only interested in the first frame.
If it uses gdk_pixbuf_new_from_file or something similar, gdk-pixbuf itself will stop after the first frame.
Created attachment 84252 [details]
test with gtk_image_new_from_file ()
Hm, attached program shows the same problem in gtk_image_new_from_file (). EOG is indeed interested in the first frame, but it seems the code for gif animations in gdk-pixbuf uses a lot of memory. Should a new bug for gtk+ be opened about it?
Hmm, that is because GtkImage actually uses gdk_pixbuf_animation_new_from_file to load the full animation, and then throws it all away, except for the first frame.
This is because GtkImage _supports_ displaying animations in this way.
To avoid this, you could use gdk_pixbuf_new_from_file() + gtk_image_set_from_pixbuf()
Retitling and changing product.
The original image from comment 0 isn't available any more, but memory usage when loading GIF animations was fixed in bug 585425. I believe this should fix most of the problems with GIF animation memory usage. Please open a new bug if the problem is still present in gdk-pixbuf 2.31 (current master).
*** This bug has been marked as a duplicate of bug 585425 ***