Mail Archives: djgpp-workers/2000/05/10/08:12:58
> Doesn't sbrk return memory to the system when called with a negative
> argument, at least on some systems? (Ours doesn't, but this is
> obviously not a problem for DJGPP anyway.)
The problem is that the memory you want to free is intermixed with
memory you don't want to free. If you use a mmap'd region elsewhere,
you can release the whole region at once without messing up your usual
heap.
> > Plus, individual mmap'd regions can be grown as needed.
>
> How would this be implemented, typically? Growing a memory region
> should need to relocate it, at least sometimes, no? It sounds a lot
> like realloc, unless I'm missing something.
mmap'd regions are placed far away from each other, say one every
256MB, with big unmapped gaps between them. That leaves plenty of
room for growth, by simply mapping more pages adjacent to them.
- Raw text -