Change: Limit memory allocations for each Squirrel instance
This can avoid out-of-memory situations due to single scripts using up the entire address space. Instead, scripts that go above the maximum are killed. The maximum is default 1 GB per script, but can be configured by a setting.
This commit is contained in:
8
src/3rdparty/squirrel/squirrel/sqmem.cpp
vendored
8
src/3rdparty/squirrel/squirrel/sqmem.cpp
vendored
@@ -9,8 +9,10 @@
|
||||
#include "../../../core/alloc_func.hpp"
|
||||
#include "../../../safeguards.h"
|
||||
|
||||
void *sq_vm_malloc(SQUnsignedInteger size){ return MallocT<char>((size_t)size); }
|
||||
#ifdef SQUIRREL_DEFAULT_ALLOCATOR
|
||||
void *sq_vm_malloc(SQUnsignedInteger size) { return MallocT<char>((size_t)size); }
|
||||
|
||||
void *sq_vm_realloc(void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size){ return ReallocT<char>(static_cast<char*>(p), (size_t)size); }
|
||||
void *sq_vm_realloc(void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size) { return ReallocT<char>(static_cast<char*>(p), (size_t)size); }
|
||||
|
||||
void sq_vm_free(void *p, SQUnsignedInteger size){ free(p); }
|
||||
void sq_vm_free(void *p, SQUnsignedInteger size) { free(p); }
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user