This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Allow shrinking of arena heaps using mmap based onovercommit settings when available
On Fri, Aug 24, 2012 at 08:37:38AM +0530, Siddhesh Poyarekar wrote:
> On Thu, 23 Aug 2012 13:53:21 -0700 (PDT), Roland wrote:
> > > + static int may_shrink_heap = -1;
> > > +
> > > + if (__builtin_expect (may_shrink_heap < 0, 0))
> > > + may_shrink_heap = check_may_shrink_heap ();
> >
> > Just call check_may_shrink_heap () directly in the use below.
> > Leave it to the malloc-sysdep.h inline to cache or whatnot.
> >
>
> That would lead to /proc/sys/vm/overcommit_memory being opened and
> closed with every call to shrink heap on Linux. The general case would
> be fine. Do we really want that?
I guarantee opening and processing a file takes 3-4 orders of
magnitude (base 10) more time than unconditionally using
mmap(MAP_FIXED)...
Rich