Fix stack overflow on mac when cooking game with too small stack size

This commit is contained in:
Wojtek Figat
2026-03-26 10:55:11 +01:00
parent 5ccc33719e
commit d1f6440a76
2 changed files with 5 additions and 3 deletions

View File

@@ -535,7 +535,8 @@ bool GameCooker::Build(BuildPlatform platform, BuildConfiguration configuration,
{
Function<int32()> f;
f.Bind(ThreadFunction);
const auto thread = ThreadSpawner::Start(f, GameCookerServiceInstance.Name, ThreadPriority::Highest);
uint32 stackSize = 4 * 1024 * 1024; // Larger stack
const auto thread = ThreadSpawner::Start(f, GameCookerServiceInstance.Name, ThreadPriority::Highest, stackSize);
if (thread == nullptr)
{
GameCookerImpl::IsRunning = false;

View File

@@ -19,11 +19,12 @@ public:
/// <param name="callback">The callback function.</param>
/// <param name="threadName">Name of the thread.</param>
/// <param name="priority">The thread priority.</param>
/// <param name="stackSize">The size of the stack to create. 0 means use the current thread's stack size</param>
/// <returns>The created thread.</returns>
static Thread* Start(const Function<int32()>& callback, const String& threadName, ThreadPriority priority = ThreadPriority::Normal)
static Thread* Start(const Function<int32()>& callback, const String& threadName, ThreadPriority priority = ThreadPriority::Normal, uint32 stackSize = 0)
{
auto runnable = New<SimpleRunnable>(true);
runnable->OnWork = callback;
return Thread::Create(runnable, threadName, priority);
return Thread::Create(runnable, threadName, priority, stackSize);
}
};