RE: Gtklist and memory leakage



Thanks for the almost immediate response.

If it is allocating memory for 128 elements at a time.  If I place 50 in the
list, remove them, then add another 50, wouldn't this preallocated memory be
reused.  It seems as though more memory is being allocated each time instead
of reusing any previously allocated memory.

The same thing also happens with buttons in boxes, in fact anything with
gtk_container_add I guess is doing this.  The way it is at the moment if I
keep adding and removing eventually I will run out of memory, which is of
course bad.  Is this correct?

Thanks for your time

Ian King

-----Original Message-----
From: gtk-list-admin gnome org [mailto:gtk-list-admin gnome org]On
Behalf Of Sven Neumann
Sent: Friday, August 03, 2001 5:06 PM
To: Ian King
Cc: GTKLIST
Subject: Re: Gtklist and memory leakage


Hi,

"Ian King" <king eiffel com> writes:

> Does anyone know of any memory leakage problems with gtklist?  Is seems
that
> if I add, say 50 list items to a list (individually with
gtk_container_add),
> clear the list, add another 50, the memory is never reclaimed.  Does
anyone
> else have this problem, is there a way to resolve it?

GtkList uses a GList to store its data and GList uses a GMemChunk created
using G_ALLOC_ONLY with a number of pre_allocated elements of 128. This
means, GList elements are allocated in bunches of 128 and are never freed
but stay around for later reuse. To change this, you can push a different
GList allocator using g_list_push_allocator().


Salut, Sven

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]