Why is it that so many running app grow in memory and only release memory when they quit ?


Quote Originally Posted by christop
3. Many possible reasons. Could be that they don't release memory that's no longer needed. Could be they have an ever-growing cache of stuff (cache invalidation is hard). Could be they use exponential reallocations with a growth factor close to or greater than ϕ (see, e.g., math - What is the ideal growth rate for a dynamically allocated array? - Stack Overflow). Could be they just have plain ol' memory leaks.

free does not necessarily release the memory back to the operating system. Most often it just puts back that memory area in a list of free blocks. These free blocks could be reused for the next calls to malloc.
c - Why free() doesn't really frees memory? - Stack Overflow