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-08-26 12:08:44 +0200
commit3bd0555f888da46a9ad7596b393d6f21f6b0221c (patch)
tree03629bcfe26f2cf9cf50e6c3c31140af67989c5c /radsecproxy.c
parent9174b0aca94fae0c483e2ae10608d660dc52f9c4 (diff)
Return free memory more aggressively.pthread_create_attr
Have free(3) call sbrk(2) when there's 4 MB to free (default on Linux seems to be 128). Patch by Fabian Mauchle.
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 d2f72b0..caec987 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -39,6 +39,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
@@ -3335,6 +3338,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);