Re: Glib and memory allocation



On Tuesday 08 February 2005 17:19, Cristiano Ghirardi wrote:

it's not clear to me what happens when memory has been allocate with
g_new or g_realloc and not freed. I mean: obviously  this memory
remains in the user space of the process as an infamous memory leak
but it seems to me that under linux 2.4.26 this memory is not freed
also when the process has died! I think that is a problem in vm in
this (quite old) release of Linux but I'd like to know if someone has
already found this strange behaviour in glib/Linux.

Sounds very unlikely. 

How are you checking the total amount of used memory? Don't rely on 'top' or 
similar tools, they often include the amount of memory tied up as cache in 
the amount of 'used' memory. Typically, almost all of the memory not used for 
anything else will be used as temporary cache until it is required for some 
other purpose, so you will find the amount of used memory in 'top' going up 
rapidly, especially when your program reads or writes a lot of external data, 
and it will stay up even when your program terminates. The 'free' utility 
will give you a better overview (e.g. 'free -m' - check out the numbers in 
the second line '-/+ buffers/cache' there).

Cheers
 -Tim



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