> Glibc does mmap instead of brk because theoretically brk can leave wasted
> memory between fragments, although apparently nobody's ever seen more than
> 10% waste in a live program, and the speed penality of taking a soft page
> fault at access time to muck about with the page tables is a LOT bigger than
> 10%...
The other reason glibc uses mmap() is because your shared libraries
are (usually) mapped smack dab in the middle of your address space.
brk() assumes a contiguous heap, so when it hits your libraries, it
has to stop, even if there is a gig of VM above the libs. mmap() can
give you an arbitrary chunk of the address space, so glibc uses it for
'large' allocations.
-Doug
-- Let us cross over the river, and rest under the shade of the trees. --T. J. Jackson, 1863 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/