lkml.org 
[lkml]   [2002]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: can we make anonymous memory non-EXECUTABLE?
From
Date
Rob Landley <landley@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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:15    [W:0.074 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site