How to release glib's slab memory allocator(in gslice.c)?
I have a question about glib's slab memory management. There, if i use g_node_new to create a new GNode object, it will initialize the allocator and then allocate some memory usage for it. But, if g_node_destory was called, only chunks managed by the allocator was returned to the slab pool and can be reused by further usage by glib slab manager, but can't be used by other allocator.(In another word, if i only call g_node_new and then call g_node_destory would insult to some memory leak!). If one program only use glib to manage its memory, it's ok. But, how about not? If not, some memory would be reserved by glib slab allocators although it's not used by any usage. So, as long as the program running, it would fail to allocate more memory in future(If not by glib).
So, I want to release the slab allocators if the job completed.What should i do? And is there a function doing some cleanup job?
Thanks.
Last edited by kcynice; 06-10-2010 at 11:05 PM.
|