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>
update_init(void)
{
struct player *dp;
- int stacksize;
update_schedule_anchor = (time(NULL) + 59) / 60 * 60;
if (update_get_schedule() < 0)
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();
}