GC "hints" needed from rg2, to free up memory?

I’m currently coding a new program, which opens a lot of large images
(photos) with Gdk::Pixbuf. These are “freed up” correctly (no more
alive reference to the object in my program), but the ruby program is
never freeing memory to the OS, unless I explicitely trigger the GC.
This is a big problem as the computer crawls swapping after a little
while :confused:

I am wondering whether there should be some kind of GC “hints” from
rg2 (I have zero knowledge of ruby GC internal)? The following quick
test shows that repeatedly allocating and reassigning with Array.new
grows memory up until a “reasonable” amount, whereas Gdk::Pixbuf.new
does not:

http://zarb.org/~gc/t/tmem.rb.out
http://zarb.org/~gc/t/tmem.rb

Used image is http://zarb.org/~gc/t/pa.jpg

(using ruby 1.8.6, rg2 0.16.0, gdk pixbuf 2.10.12)


Guillaume C. - http://zarb.org/~gc/


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Hi,

yesterday i had exactly the same problem. I pumped up to several hundred
pixbufs of 640x480 troug a Gtk::Image. I coul follow like the memory got
eaten and than the application got stuck caus the swap got active.

My solution was to put a GC.start after the assignement of every new
pixbuf to the image. That solved the problem nearly completly and for
the performance it was also no problem.

But i think, that is not the right way.

Cheers
detlef

Am Freitag, den 29.06.2007, 09:58 +0200 schrieb Guillaume C.:

grows memory up until a “reasonable” amount, whereas Gdk::Pixbuf.new
does not:

http://zarb.org/~gc/t/tmem.rb.out
http://zarb.org/~gc/t/tmem.rb

Used image is http://zarb.org/~gc/t/pa.jpg

(using ruby 1.8.6, rg2 0.16.0, gdk pixbuf 2.10.12)


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs