mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Call malloc_trim() regularly to improve deallocation behavior (#14707)
This commit is contained in:
parent
08485f6781
commit
71893807b3
9 changed files with 99 additions and 4 deletions
|
@ -176,6 +176,32 @@ public:
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Calculate size of vertices and indices in memory
|
||||
virtual size_t getSize() const
|
||||
{
|
||||
size_t ret = 0;
|
||||
switch (getVertexType()) {
|
||||
case video::EVT_STANDARD:
|
||||
ret += sizeof(video::S3DVertex) * getVertexCount();
|
||||
break;
|
||||
case video::EVT_2TCOORDS:
|
||||
ret += sizeof(video::S3DVertex2TCoords) * getVertexCount();
|
||||
break;
|
||||
case video::EVT_TANGENTS:
|
||||
ret += sizeof(video::S3DVertexTangents) * getVertexCount();
|
||||
break;
|
||||
}
|
||||
switch (getIndexType()) {
|
||||
case video::EIT_16BIT:
|
||||
ret += sizeof(u16) * getIndexCount();
|
||||
break;
|
||||
case video::EIT_32BIT:
|
||||
ret += sizeof(u32) * getIndexCount();
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue