summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2013-08-26 12:04:07 +0200
committerLinus Nordberg <linus@nordberg.se>2013-09-02 13:45:46 +0200
commitdbff4652bc09a88e931c859ab63b33e94a2c3ee3 (patch)
treec3786d63b582af3c46e5610d6ab69b8b167fc789 /radsecproxy.c
parent55ca280f16473095380e22c574910f106b11058f (diff)
Return free memory more aggressively.
Have free(3) call sbrk(2) when there's 4 MB to free (default on Linux seems to be 128). Patch by Fabian Mauchle. Conflicts: configure.ac
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 56abe3e..d05f9c9 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -52,6 +52,9 @@
#include <string.h>
#include <unistd.h>
#include <limits.h>
+#if defined(HAVE_MALLOPT)
+#include <malloc.h>
+#endif
#ifdef SYS_SOLARIS9
#include <fcntl.h>
#endif
@@ -3348,6 +3351,10 @@ int radsecproxy_main(int argc, char **argv) {
debugx(1, DBG_ERR, "pthread_attr_init failed");
if (pthread_attr_setstacksize(&pthread_attr, PTHREAD_STACK_SIZE))
debugx(1, DBG_ERR, "pthread_attr_setstacksize failed");
+#if defined(HAVE_MALLOPT)
+ if (mallopt(M_TRIM_THRESHOLD, 4 * 1024) != 1)
+ debugx(1, DBG_ERR, "mallopt failed");
+#endif
for (i = 0; i < RAD_PROTOCOUNT; i++)
protodefs[i] = protoinits[i](i);