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 335792 - Loading certain GIF files causes massive and immediate memory leak
Loading certain GIF files causes massive and immediate memory leak
Status: RESOLVED DUPLICATE of bug 345707
Product: libgnomeui
Classification: Deprecated
Component: general
2.14.x
Other All
: Normal critical
: ---
Assigned To: libgnomeui maintainers
libgnomeui maintainers
Depends on:
Blocks:
 
 
Reported: 2006-03-24 06:07 UTC by mike morrison
Modified: 2006-12-02 13:11 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
this file causes gdkpixbuf loader to eat up all your memory (555.33 KB, image/gif)
2006-03-24 06:11 UTC, mike morrison
Details

Description mike morrison 2006-03-24 06:07:05 UTC
Please describe the problem:
Using GdkPixbufLoader or gdk_pixbuf_new_from_file on certain gif files causes
massive memory leak.

Happens in my program, gthumb, nautilus, and probably any others that try to
load this gif:

http://people.freedesktop.org/~company/byzanz/demo.gif

Steps to reproduce:
1. download http://people.freedesktop.org/~company/byzanz/demo.gif
2. open nautilus , gthumb, or any other program that would load it through
GdkPixbuf. or write a little test app.

  GError *error = NULL;
  gdk_pixbuf_new_from_file("demo.gif",&error);


Actual results:
Memory gets eaten up really really fast. You'll have to be quick with the ctrl-c
or killall.

Expected results:
I expect the file to load nicely without eating up all my memory.

Does this happen every time?
Yes.

Other information:
I'll try to attach the offending file.
Comment 1 mike morrison 2006-03-24 06:11:01 UTC
Created attachment 61885 [details]
this file causes gdkpixbuf loader to eat up all your memory

this gif animation loads/plays fine in firefox
Comment 2 Matthias Clasen 2006-03-24 17:18:41 UTC
The gif loader is unfortunately not designed to handle multi-megabyte gif
animations. I have committed a fix to make it load only the first frame 
if you use gdk_pixbuf_new_from_file() recently, but that does not help
if you are using a pixbuf loader.
Comment 3 Sebastien Bacher 2006-03-25 15:48:41 UTC
Ubuntu bug about that: https://launchpad.net/distros/ubuntu/+source/gtk+2.0/+bug/35586
Comment 4 Matthias Clasen 2006-03-25 18:26:14 UTC
Fixed in 2.8.16, unless somebody tells me otherwise.
Comment 5 mike morrison 2006-03-26 02:42:30 UTC
I tried 2.8.16 on ubuntu dapper and it does not appear to be fixed.
Comment 6 Sebastien Bacher 2006-03-26 10:21:16 UTC
example of the ubuntu page: http://librarian.launchpad.net/1786159/demo-software-properties.gif
Comment 7 Matthias Clasen 2006-03-27 04:41:18 UTC
Mike, can you be more specific ? 
Are you still seeing gdk_pixbuf_new_from_file() load the full animation before handing out the first frame ? 
Comment 8 mike morrison 2006-03-27 05:15:52 UTC
What I'm saying is that I tried 2.8.16 on ubuntu dapper and nautilus, gthumb, and my program all still use up all the available memory when trying to load the gif file. I am not using gdk_pixbuf_new_from_file() though, I'm using GdkPixbufLoader (and I assume nautilus and gthumb are doing the same).

If you marked this bug as "fixed" because gdk_pixbuf_new_from_file() had been updated to only get the first frame of a gif animation then that is only fixing part of the problem. It does not address the problem with GdkPixbufLoader and presumably gdk_pixbuf_animation_new_from_file().

Comment 9 Matthias Clasen 2006-03-27 06:39:57 UTC
There is no real problem with these two though:

- GdkPixbufLoader gives you a signal everytime a frame is completed (or even
  more often), so you can just stop loading when you have enough (ie one complete
  frame).

- If you call gdk_pixbuf_animation_new_from_file(), you explicitly ask for the
  full animation. It is unfortunate that the gif loader is not very economic about
  storing animations, so this will can be huge, but you asked for it...
Comment 10 Matthias Clasen 2006-03-27 15:54:29 UTC
Sebastien determined that it is gnome_gdk_pixbuf_new_from_uri_at_scale which
uses a GdkPixbufLoader. It should just stop when the first frame is complete.
the area_updated signal and gdk_pixbuf_animation_iter_on_currently_loading_frame
may help with determining when the first frame is complete.
Comment 11 mike morrison 2006-03-27 16:13:12 UTC
It IS quite unfortunate that the gif loader is not very economic about storing animations. I did ask for the animation but I did not expect loading a ~500kb gif file would use up all my memory (I have 1GB) and bring my system to a halt.

Sure it is nice to fix the "I only need the first frame" case, but I don't think just fixing this case is good enough. This is why I filed this bug report and I think it should only be closed when a more efficient solution for storing gif animations can be implemented.

Should I change the title of this bug to make it more obvious that it is not just about loading a static image? 
Comment 12 Kjartan Maraas 2006-06-20 20:12:46 UTC
Moving this to the right product.
Comment 13 Kjartan Maraas 2006-08-10 09:21:36 UTC
Is this a duplicate of bug 345707 ?
Comment 14 Sebastien Bacher 2006-08-10 14:53:18 UTC
looks like a duplicate, I'll try when the next tarball if that issue is fixed too
Comment 15 Kjartan Maraas 2006-12-02 13:11:37 UTC

*** This bug has been marked as a duplicate of 345707 ***