|
|
@ -101,14 +101,21 @@ namespace LuaUtil
|
|
|
|
<< " is blocked because Lua memory limit (configurable in settings.cfg) is exceeded";
|
|
|
|
<< " is blocked because Lua memory limit (configurable in settings.cfg) is exceeded";
|
|
|
|
return nullptr;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self->mTotalMemoryUsage += smallAllocDelta + bigAllocDelta;
|
|
|
|
|
|
|
|
self->mSmallAllocMemoryUsage += smallAllocDelta;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void* newPtr = nullptr;
|
|
|
|
void* newPtr = nullptr;
|
|
|
|
if (nsize == 0)
|
|
|
|
if (nsize == 0)
|
|
|
|
free(ptr);
|
|
|
|
free(ptr);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
newPtr = realloc(ptr, nsize);
|
|
|
|
newPtr = realloc(ptr, nsize);
|
|
|
|
|
|
|
|
if (!newPtr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log(Debug::Error) << "Lua realloc " << osize << "->" << nsize << " failed";
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
self->mTotalMemoryUsage += smallAllocDelta + bigAllocDelta;
|
|
|
|
|
|
|
|
self->mSmallAllocMemoryUsage += smallAllocDelta;
|
|
|
|
|
|
|
|
|
|
|
|
if (bigAllocDelta != 0)
|
|
|
|
if (bigAllocDelta != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|