[core] reduce M_TOP_PAD to default on small system
reduce M_TOP_PAD to default on small systems to reduce memory usage
(triggers when server.max-connections <= 16)
x-ref:
man mallopt
@@ -1173,6 +1173,11 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
return 0;
}
+ #if defined(HAVE_MALLOC_TRIM)
+ if (srv->srvconf.max_conns <= 16 && malloc_top_pad == 524288)
+ malloc_top_pad = 131072; /*(reduce memory use on small systems)*/
+ #endif
+
if (oneshot_fd) {
if (oneshot_fd <= STDERR_FILENO) {
log_error(srv->errh, __FILE__, __LINE__,
