ldap/servers/slapd/main.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 8b33f238cea872503b68fdabc65758ec55cc8ca3
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Sep 7 13:47:10 2012 -0400
Ticket 386 - large memory growth with ldapmodify(heap fragmentation)
Bug Description: large entry cache can lead to significant memory fragmentation.
Fix Description: On linux you can disable "fastbins", or modify the size of
the bins
using mallopt(), which can help reduce the memory fragmentation.
https://fedorahosted.org/389/ticket/386
Reviewed by: richm(Thanks Rich!)
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index 7b15249..84ce01d 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -40,7 +40,7 @@
# include <config.h>
#endif
-
+#include <malloc.h>
#include <ldap.h>
#undef OFF
#undef LITTLE_ENDIAN
@@ -662,6 +662,17 @@ main( int argc, char **argv)
ldap_set_option( 0x1, LDAP_OPT_MEMALLOC_FN_PTRS, &memalloc_fns );
}
#endif
+#ifdef LINUX
+ char *m = getenv( "SLAPD_MXFAST" );
+ if(m){
+ int val = atoi(m);
+ int max = 80 * (sizeof(size_t) / 4);
+
+ if(val >= 0 && val <= max){
+ mallopt(M_MXFAST, val);
+ }
+ }
+#endif
/*
* Initialize NSPR very early. NSPR supports implicit initialization,
* but it is not bulletproof -- so it is better to be explicit.