diff --git a/src/thread/Thread.cxx b/src/thread/Thread.cxx
index 2932d47..fd1f3ce 100644
--- a/src/thread/Thread.cxx
+++ b/src/thread/Thread.cxx
@@ -43,8 +43,12 @@ Thread::Start(void (*_f)(void *ctx), void *_ctx, Error &error)
 #ifndef NDEBUG
 	creating = true;
 #endif
-
-	int e = pthread_create(&handle, nullptr, ThreadProc, this);
+	pthread_attr_t attr, *attrptr = nullptr;
+	if ((pthread_attr_init(&attr) == 0)
+	    && (pthread_attr_setstacksize(&attr, 1024*1024) == 0)) {
+		attrptr = &attr;
+	}
+	int e = pthread_create(&handle, attrptr, ThreadProc, this);
 
 	if (e != 0) {
 #ifndef NDEBUG
