[Nodogsplash] [PATCH 2/3] Optimize thread stack creation size for small systems

Sven Eckelmann sven at open-mesh.com
Fri Nov 8 19:17:17 CET 2013


The size of 2 MiB per thread is a little bit to heavy for small systems like
common home routers. Using a smaller stack (64 KiB) should be enough for the
work of the nodogsplash threads. It may needs adjustments when more memory
hungry operations are added.

Signed-off-by: Sven Eckelmann <sven at open-mesh.com>
---
 src/gateway.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gateway.c b/src/gateway.c
index 2218355..6abd318 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -346,9 +346,10 @@ int main(int argc, char **argv)
 	debug(LOG_NOTICE,"Initializing signal handlers");
 	init_signals();
 
-	/* Init pthread behavior; detach automatically */
+	/* Init pthread behavior; detach automatically and keep stack size low */
 	pthread_attr_init(&thread_attr);
 	pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+	pthread_attr_setstacksize(&thread_attr, 65536);
 
 	if (config->daemon) {
 
-- 
1.8.4.2




More information about the Nodogsplash mailing list