Re: Problems freeing memory in GHashTable Glib 2.12.11



On Fri, Apr 27, 2007 at 05:55:32PM +0100, Pedro Rafael Alves Sim?es wrote:
> I'm having difficulties freeing memory from a GHashTable. First, I add 1000000 elements to the hashtable, the image01.jpg in attach shows the top output from the process after the additions. At this moment the process is consuming 288M of physical memory. Then, I call the g_hash_table_remove_all function to remove all the elements from the hashtable, the image02.jpg shows the top output after the deletions. At this point I'm starting to get confused. I was expecting to free more memory than the top shows (image03.jpg), it only frees 3M of it showing 285M . And now, even more weird is when I add again the 1000000 elements to the hashtable and the memory doesn't 288M, like earlier, but increases 1M, showing 289M. This is supposed to happen?

Yes, it is.  See
http://developer.gnome.org/doc/API/2.0/glib/glib-Memory-Slices.html
and the references therein.

(Also note the memory usage numbers reported by kernel and
subsequently by top, especially VIRT, are only vaguely
related to what one normally imagines as application memory
usage.)

Yeti

--
http://gwyddion.net/



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