[PATCH v2] Allow shrinking of arena heaps using mmap based on overcommit settings when available

Rich Felker dalias@aerifal.cx
Fri Aug 24 17:39:00 GMT 2012


On Fri, Aug 24, 2012 at 08:56:28PM +0530, Siddhesh Poyarekar wrote:
> +  int fd = open_not_cancel_2 ("/proc/sys/vm/overcommit_memory",
> +			      O_RDONLY | O_CLOEXEC);
> +
> +  if (fd != -1)
> +    {
> +      char val = 0;
> +      int n = read_not_cancel (fd, &val, 1);
> +
> +      may_shrink_heap = (n > 0 && val == 2);

Don't you mean '2', not 2?

Rich



More information about the Libc-alpha mailing list