Rob Landley <landley _at_ trommello.org> writes: > 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 _at_ vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
References:
- Re: can we make anonymous memory non-EXECUTABLE?Rik van Riel <riel _at_ conectiva.com.br>
- Re: can we make anonymous memory non-EXECUTABLE?"H. Peter Anvin" <hpa _at_ zytor.com>
- Re: can we make anonymous memory non-EXECUTABLE?Rob Landley <landley _at_ trommello.org>
- Prev by Date: Re: [2.4.17/18pre] VM and swap - it's really unusable
- Next by Date: Re: [PATCH] PAGE_SIZE IO for RAW (RAW VARY)
- Previous by thread: Re: can we make anonymous memory non-EXECUTABLE?
- Next by thread: Re: can we make anonymous memory non-EXECUTABLE?
- Indexes:[Main][Thread]