mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Set the glibc MMAP limit to a static value to avoid the dynamic limit
2009-02-17 Alexander Larsson <alexl@redhat.com> * configure.in: * src/nautilus-main.c: Set the glibc MMAP limit to a static value to avoid the dynamic limit hitting bad behaviour due to the large temporary allocations when creating the desktop background. It would raise the limit to a large value causing several large allocations on the heap which are then not returned to the OS. svn path=/trunk/; revision=14963
This commit is contained in:
parent
4dd81c63bb
commit
fbe7bdd104
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2009-02-17 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* configure.in:
|
||||
* src/nautilus-main.c:
|
||||
Set the glibc MMAP limit to a static value to avoid the dynamic
|
||||
limit hitting bad behaviour due to the large temporary allocations
|
||||
when creating the desktop background. It would raise the limit
|
||||
to a large value causing several large allocations on the
|
||||
heap which are then not returned to the OS.
|
||||
|
||||
2009-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* configure.in:
|
||||
|
|
|
@ -110,11 +110,11 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
|
|||
|
||||
dnl ==========================================================================
|
||||
|
||||
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/param.h)
|
||||
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/param.h malloc.h)
|
||||
|
||||
dnl ==========================================================================
|
||||
|
||||
AC_CHECK_FUNCS(statfs statvfs)
|
||||
AC_CHECK_FUNCS(statfs statvfs mallopt)
|
||||
AC_CHECK_HEADERS(sys/statfs.h sys/statvfs.h)
|
||||
|
||||
dnl
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
@ -342,6 +345,20 @@ main (int argc, char *argv[])
|
|||
{ NULL }
|
||||
};
|
||||
|
||||
#if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD)
|
||||
/* Nautilus uses lots and lots of small and medium size allocations,
|
||||
* and then a few large ones for the desktop background. By default
|
||||
* glibc uses a dynamic treshold for how large allocations should
|
||||
* be mmaped. Unfortunately this triggers quickly for nautilus when
|
||||
* it does the desktop background allocations, raising the limit
|
||||
* such that a lot of temporary large allocations end up on the
|
||||
* heap and are thus not returned to the OS. To fix this we set
|
||||
* a hardcoded limit. I don't know what a good value is, but 128K
|
||||
* was the old glibc static limit, lets use that.
|
||||
*/
|
||||
mallopt (M_MMAP_THRESHOLD, 128 *1024);
|
||||
#endif
|
||||
|
||||
g_thread_init (NULL);
|
||||
|
||||
/* This will be done by gtk+ later, but for now, force it to GNOME */
|
||||
|
|
Loading…
Reference in a new issue