nautilus r14963 - in trunk: . src



Author: alexl
Date: Tue Feb 17 10:55:00 2009
New Revision: 14963
URL: http://svn.gnome.org/viewvc/nautilus?rev=14963&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/nautilus-main.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Feb 17 10:55:00 2009
@@ -110,11 +110,11 @@
 
 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

Modified: trunk/src/nautilus-main.c
==============================================================================
--- trunk/src/nautilus-main.c	(original)
+++ trunk/src/nautilus-main.c	Tue Feb 17 10:55:00 2009
@@ -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 @@
 		{ 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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]