free() does not call sbrk()

Martin Walter martin.walter@gmail.com
Tue Sep 15 19:29:00 GMT 2009


Hello!

I am just testing my port of the newlib-1.17.0 for our architecture
and came across the following issue:

(1) the newlib libc documentation says that free() invokes sbrk() with
a negative incrementer argument, but a simple debug trace reveals that
sbrk() is actually never called by free().
(2) when malloc()'ing and free()'ing chunks of memory in a loop it
seems that memory is actually never free()'d, which might be due to
(1). instead, the heap keeps on growing.

I guess this is not the intended behavior. Any ideas? Thank you!

Cheers,
Martin



More information about the Newlib mailing list