sbrk(2) broken

Dag-Erling Smørgrav des at
Tue Jan 8 10:37:04 PST 2008

Peter Schuller <peter.schuller at> writes:
> The problem with malloc() being that, unless I am missing something,
> malloc will never be able to give back memory to the kernel except
> insofar as the memory mapped is continuously unused between some
> location and the break (in the case of sbrk()) or over the entire
> range (mmap()).

Actually, malloc(3) can use madvise(2) to notify the kernel that
arbitrary pages in the arena are unused and can be discarded.  The
current implementation will do so if the H option is specified.

Dag-Erling Smørgrav - des at

More information about the freebsd-current mailing list