]> git.pond.sub.org Git - empserver/commitdiff
update: Set thread stack size to 512 KiB
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 6 Jan 2014 14:26:24 +0000 (15:26 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 6 Jan 2014 19:50:06 +0000 (20:50 +0100)
Empire 2 settled on this formula for the stack size:

stacksize = 100000 +
    /* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) +
    sizeof(char *));

Obviously attempts to provide space for a known configuration-
dependent stack hog.  The hog went away when finish_sects()'s arrays
became dynamically allocated in 4.2.0.

Adjusting for that by dropping the extra term might well do (I observe
only a few KiB of stack used on my system).  But let's set it to 512
KiB instead to be on the safe side.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/server/update.c

index f187eb86af5c7b1959ac56b679803c335b95a049..9961dab149a937ef6a4795378758e67ab5af6b4f 100644 (file)
@@ -69,7 +69,6 @@ void
 update_init(void)
 {
     struct player *dp;
-    int stacksize;
 
     update_schedule_anchor = (time(NULL) + 59) / 60 * 60;
     if (update_get_schedule() < 0)
@@ -78,11 +77,7 @@ update_init(void)
     dp = player_new(-1);
     if (!dp)
        exit_nomem();
-    /* FIXME ancient black magic; figure out true stack need */
-    stacksize = 100000 +
-/* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) +
-                                       sizeof(char *));
-    update_thread = empth_create(update_sched, stacksize, 0, "Update", dp);
+    update_thread = empth_create(update_sched, 512 * 1024, 0, "Update", dp);
     if (!update_thread)
        exit_nomem();
 }