1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

track memory correctly

This commit is contained in:
Lars 2025-05-20 14:00:18 -07:00
parent 43a86a0efe
commit 90da985ea0
2 changed files with 5 additions and 1 deletions

View file

@ -117,7 +117,8 @@ MapBlock::~MapBlock()
#endif #endif
delete[] data; delete[] data;
porting::TrackFreedMemory(sizeof(MapNode) * nodecount); if (!m_is_mono_block)
porting::TrackFreedMemory(sizeof(MapNode) * nodecount);
} }
static inline size_t get_max_objects_per_block() static inline size_t get_max_objects_per_block()

View file

@ -440,6 +440,9 @@ private:
void reallocate(u32 c, MapNode n) void reallocate(u32 c, MapNode n)
{ {
delete[] data; delete[] data;
if (c == 1)
porting::TrackFreedMemory(sizeof(MapNode) * nodecount);
data = new MapNode[c]; data = new MapNode[c];
for (u32 i = 0; i < c; i++) for (u32 i = 0; i < c; i++)
data[i] = n; data[i] = n;