mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-06 00:40:04 +00:00
[Lua] Fix memory tracking
This commit is contained in:
parent
2aac6abb85
commit
d0a82437a4
@ -126,11 +126,14 @@ namespace LuaUtil
|
||||
id = self->mActiveScriptIdStack.back();
|
||||
bigAllocDelta = nsize;
|
||||
}
|
||||
if (id.mContainer)
|
||||
if (id.mIndex >= 0)
|
||||
{
|
||||
if (static_cast<size_t>(id.mIndex) >= self->mMemoryUsage.size())
|
||||
self->mMemoryUsage.resize(id.mIndex + 1);
|
||||
self->mMemoryUsage[id.mIndex] += bigAllocDelta;
|
||||
}
|
||||
if (id.mContainer)
|
||||
{
|
||||
id.mContainer->addMemoryUsage(id.mIndex, bigAllocDelta);
|
||||
if (newPtr && nsize > smallAllocSize)
|
||||
self->mBigAllocOwners.emplace(newPtr, AllocOwner{ id.mContainer->mThis, id.mIndex });
|
||||
|
@ -23,7 +23,7 @@ namespace LuaUtil
|
||||
struct ScriptId
|
||||
{
|
||||
ScriptsContainer* mContainer = nullptr;
|
||||
int mIndex; // index in LuaUtil::ScriptsConfiguration
|
||||
int mIndex = -1; // index in LuaUtil::ScriptsConfiguration
|
||||
};
|
||||
|
||||
struct LuaStateSettings
|
||||
|
Loading…
x
Reference in New Issue
Block a user