1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 08:35:20 +02:00

Call malloc_trim() regularly to improve deallocation behavior (#14707)

This commit is contained in:
sfan5
2024-06-07 16:57:30 +02:00
committed by GitHub
parent 08485f6781
commit 71893807b3
9 changed files with 99 additions and 4 deletions

View File

@@ -800,11 +800,16 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
MapBlockMesh::~MapBlockMesh()
{
size_t sz = 0;
for (scene::IMesh *m : m_mesh) {
for (u32 i = 0; i < m->getMeshBufferCount(); i++)
sz += m->getMeshBuffer(i)->getSize();
m->drop();
}
for (MinimapMapblock *block : m_minimap_mapblocks)
delete block;
porting::TrackFreedMemory(sz);
}
bool MapBlockMesh::animate(bool faraway, float time, int crack,