Hi,
I created a scenenode which dynamically loads/drops some meshbuffers, however im having some trouble with dropping the meshes.
Now i noticed that my application has a memory leak, I use the following code to drop the mesh:
Code: Select all
if(!m_pMeshBuffer->drop()
{
CString sMsg;
sMsg.Format("%s: Mesh was not dropped MBrefCount:%d \n", __FUNCTION__, m_pMeshBuffer->getReferenceCount());
::OutputDebugString(sMsg);
ASSERT(FALSE);
}
The wierd thing is, that i drop and load meshes into the scene node dynamically and it is random whether the mesh is dropped succesfully or not. The output string then shows that the reference count of the mesh is 1, so something still has a reference to it. I am quite sure that i never grab the mesh any where in my code. Has anybody experienced something similar? Or maybe know where I should look?
One other thing I would like to know is, reading this topic I see salvik said the following:
The texture cache automatically holds on to all loaded textures until you manually remove them or until the driver is reset. This is done for the exact reason you mentioned: multiple materials and meshes may use the same texture. By holding onto them, time is saved since the GPU never has to reload the textures.
I have set a texture on my scenenode and a shader, do i understand this correctly that even though all scenenodes which use the a particular texture have been dropped you still need to remove the texture manually?