mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:10:40 +02:00
Reduce V8 stack size to 256K. Otherwise the interface can be crashed with a stack overflow in a script.
This commit is contained in:
parent
e1c22b5c7c
commit
640cee0360
1 changed files with 21 additions and 14 deletions
|
@ -377,8 +377,15 @@ ScriptEngineV8::ScriptEngineV8(ScriptManager* scriptManager) :
|
|||
_v8InitMutex.lock();
|
||||
std::call_once ( _v8InitOnceFlag, [ ]{
|
||||
v8::V8::InitializeExternalStartupData("");
|
||||
//V8TODO might cause crashes if it's too much
|
||||
v8::V8::SetFlagsFromString("--stack-size=900000");
|
||||
|
||||
// Experimentally determined that the maximum size that works on Linux with a stack size of 8192K is 8182.
|
||||
// That would seem to be the overhead of our code and V8.
|
||||
//
|
||||
// Windows stacks are 1MB.
|
||||
//
|
||||
// Based on that, going with 256K for stacks for now. That seems like a reasonable value.
|
||||
// We'll probably need a more complex system on the longer term, with configurable limits.
|
||||
v8::V8::SetFlagsFromString("--stack-size=256");
|
||||
v8::Platform* platform = getV8Platform();
|
||||
v8::V8::InitializePlatform(platform);
|
||||
v8::V8::Initialize(); qCDebug(scriptengine) << "V8 platform initialized";
|
||||
|
|
Loading…
Reference in a new issue