[Gtk-sharp-list] Disposing problem

Gonçal Carrero Puig gcarrero@teklamedia.com
Sat, 08 Nov 2003 19:54:21 +0100


Hello:

I'm having problems with pixbuff, I'm trying to make thumbnails of a
directory and all it's ok, but the program hungs because it's not
freeing memory. 

I've this test:


using System;
using Gtk;
using Gdk;

class album
{
	public static void Main(string[] args)
	{
		Gtk.Application.Init();
		Pixbuf p;
		for (int i=0;i<100;i++){
			p = new Pixbuf("DSCF00022.JPG");
			p.Dispose();
			}	

	}

}

In the first iterations it's ok, but at some time you see every
iteration is more time consuming and if you look at the memory in use
you will see an incredible amount of memory in use. 
(I get a crash on my Linux System, it freezes X window not responding to
any event, I've to reboot my system.)


After reviewing glib.Object.Dispose I saw that it enqueues all requests
to dispose and then the idle will do the rest calling  to
PerformQueuedUnrefs, but as I saw in my program this method was never
called. I've compiled a version of glib-sharp calling directly each time
the PerformQueuedUnrefs and then runnig this program again all is OK.

Anyone knows why idle is never calling PerformedQueuedUnrefs?

Thank you,

Gonçal