What does “TCMalloc currently does not return any memory to the system. ” mean?

StackOverflow https://stackoverflow.com/questions/5975644

  •  12-11-2019
  •  | 
  •  

Question

At the http://goog-perftools.sourceforge.net/doc/tcmalloc.html it is stated: "CMalloc currently does not return any memory to the system." I presume that it means that if I allocate 42 mb and free it system wont get it back, but next time i allocate 47 MB it will steal only 5 MB more? My question what happens with loaded dll or .so modules. Do they get their own chunk of memory that is not released until program exits. I ask because if I want to write run time updateable sw I must load new dlls without exiting the program. So my question is: if i use -ltcmalloc and I'm constantly loading and unloading dlls that allocate and free memory will that cause mem usage to explode? I presume it is a stupid question, but I don't know if each dll uses its own memory allocation stuff or if if the mem allocation is on per process level.

Was it helpful?

Solution

Memory belongs to a process, not to DLLs. So memory will normally be held onto until the process ends. This is a common feature of most malloc implementations, not just the one you are asking about.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top