On Sun, Apr 26, 2015 at 08:53:10PM +0430, sadegh solati wrote:
> Hi Everyone
> I read the following document about OpenBSD new malloc.
> http://www.openbsd.org/papers/eurobsdcon2009/otto-malloc.pdf
> On the page 17 it says that "Regions free'ed are kept for later reuse."
> I have a long living program which do alot of malloc and free. I want
> free'ed memory to be returned back to the OS. How can i do that? is there
> any equivalent function like malloc_trim in openBSD?
>
> Thanks
Don't worry, only a handfull of pages max are cached.
But if youy are really worried, you can set the malloc cache size to 0.
See malloc(3).
-Otto