Look the following codes in OctTree
...
OctTree(const core::array<SMeshChunk>& meshes, s32 minimalPolysPerNode=128)
{
nodeCount = 0;
IndexDataCount = meshes.size();
//some problems here
IndexData = new SIndexData[IndexDataCount];
core::array<SIndexChunk>* indexChunks = new core::array<SIndexChunk>;
SIndexChunk ic;
for (u32 i=0; i<meshes.size(); ++i)
{
IndexData.CurrentSize = 0;
IndexData.MaxSize = meshes.Indices.size();
IndexData.Indices = new u16[IndexData.MaxSize];
ic.MaterialId = meshes.MaterialId;
indexChunks->push_back(ic);
SIndexChunk& tic = (*indexChunks);
for (u32 t=0; t<meshes.Indices.size(); ++t)
tic.Indices.push_back(meshes.Indices[t]);
}
// create tree
Root = new OctTreeNode(nodeCount, 0, meshes, indexChunks, minimalPolysPerNode);
}
and the construction of OctTreeNode
OctTreeNode(u32& nodeCount, u32 currentdepth,
const core::array<SMeshChunk>& allmeshdata,
core::array<SIndexChunk>* indices,
s32 minimalPolysPerNode) : IndexData(0),
Depth(currentdepth+1)
the pointer IndexData is reset to NULL without deleting original datas.
So I'm a little fuzzle will it cause memory leak?
Some problems in the OctTree.h
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
OctTree::IndexData is not the same as OctTreeNode::IndexData.
Is there some specific reason why you think this is causing a problem? Valgrinding example 2 reports some leaks in glX, but nothing in OctTree.
Is there some specific reason why you think this is causing a problem? Valgrinding example 2 reports some leaks in glX, but nothing in OctTree.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way