Question regarding bug 1128.

Kaz Kylheku kaz@zeugmasystems.com
Fri Mar 28 00:27:00 GMT 2008


Hi All,

I'm scoping a fix for bug 1128 against malloc, i.e these problems:

- after sbrk fails, mmap is used, rendering the main_arena
  non-contiguous, so that free no longer returns memory to the OS.

- sbrk keeps being re-tried anyway.

My question is, would it make sense to borrow arenas to fix this?

That is to say, if USE_ARENAS is enabled, would it be a good
strategy, if sbrk fails in main_arena, to simply switch to
or allocate another arena, thereby leaving main_arena contiguous?

Is there anything wrong with this obvious approach?

Then the main_arena could give back memory to the OS using
negative sbrk calls, malloc wouldn't be hammering away at a
non-working sbrk in main_arena, and the new arena would also
give back memory to the OS using munmap by way of heap_trim.

Thanks for any feedback.




More information about the Libc-alpha mailing list