Anyone have any idea why apps are starting to search /proc/sys/vm?

Jerry James loganjerry at gmail.com
Sat Oct 6 15:27:18 UTC 2012


On Sat, Oct 6, 2012 at 5:44 AM, Daniel J Walsh <dwalsh at redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> https://bugzilla.redhat.com/show_bug.cgi?id=863258
> https://bugzilla.redhat.com/show_bug.cgi?id=863257
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iEYEARECAAYFAlBwGYAACgkQrlYvE4MpobNXbgCeIK9DN+1wU3bO6cRneC4O7U9q
> rIYAoOX+qkNDvkaZD2xPFBgVyBeCfXeD
> =CRP0
> -----END PGP SIGNATURE-----

Perhaps this glibc code (in sysdeps/unix/sysv/linux/malloc-sysdep.h)?

static inline bool
check_may_shrink_heap (void)
{
  static int may_shrink_heap = -1;

  if (__builtin_expect (may_shrink_heap >= 0, 1))
    return may_shrink_heap;

  may_shrink_heap = __libc_enable_secure;

  if (__builtin_expect (may_shrink_heap == 0, 1))
    {
      int fd = open_not_cancel_2 ("/proc/sys/vm/overcommit_memory",
                                  O_RDONLY | O_CLOEXEC);
      if (fd >= 0)
        {
          char val;
          ssize_t n = read_not_cancel (fd, &val, 1);
          may_shrink_heap = n > 0 && val == '2';
          close_not_cancel_no_status (fd);
        }
    }

  return may_shrink_heap;
}

-- 
Jerry James
http://www.jamezone.org/


More information about the devel mailing list