ErgoSmurof
01-07-2009 18:14:08
Hello all,
I have been playing with: demos\ogreode\SimpleScenes.py, and am seeing what seems like a leak related to EntityInformer createStaticTriangleMesh. I tested this by adding the ability to remove the last added trimesh, and noticing that memory only ever increases -- it never seems to re-use memory from a previously allocated and freed trimesh.
Here's what I did:
- Added "deleteLastDroppedObject" function to SimpleScenes class (code shown at end).
- Added new key handler to SimpleScenes_BoxStack -- so that pressing "B" would invoke deleteLastDroppedObject. This lets me subtract objects from the scene.
- Added a bunch of trimeshes, then removed them all.
- Added a couple more.
Each time I add a trimesh, it consumes more memory. This happens regardless of whether I've just deleted enough of them that it should already have enough memory allocated to handle it. I realize fragmentation can be an issue, but I think there's more going on here than that. Do you see any problems in how I'm handling the deletion, or do you have any suggestions as to how I can debug this?
I am working on a publicly released commercial application that is being affected by out of control memory consumption, that I'm pretty sure I've narrowed down to OgreODE and my invocations of createStaticTriangleMesh.
Thanks!
I have been playing with: demos\ogreode\SimpleScenes.py, and am seeing what seems like a leak related to EntityInformer createStaticTriangleMesh. I tested this by adding the ability to remove the last added trimesh, and noticing that memory only ever increases -- it never seems to re-use memory from a previously allocated and freed trimesh.
Here's what I did:
- Added "deleteLastDroppedObject" function to SimpleScenes class (code shown at end).
- Added new key handler to SimpleScenes_BoxStack -- so that pressing "B" would invoke deleteLastDroppedObject. This lets me subtract objects from the scene.
- Added a bunch of trimeshes, then removed them all.
- Added a couple more.
Each time I add a trimesh, it consumes more memory. This happens regardless of whether I've just deleted enough of them that it should already have enough memory allocated to handle it. I realize fragmentation can be an issue, but I think there's more going on here than that. Do you see any problems in how I'm handling the deletion, or do you have any suggestions as to how I can debug this?
I am working on a publicly released commercial application that is being affected by out of control memory consumption, that I'm pretty sure I've narrowed down to OgreODE and my invocations of createStaticTriangleMesh.
Thanks!
def deleteLastDroppedObject(self):
if (self._key_delay < self.KEY_DELAY):
return 0
if [] == self._geoms:
return 0
geom = self._geoms.pop()
body = self._bodies.pop()
node = body.getParentSceneNode()
clearList = []
if node:
name = node.getName()
num = node.numAttachedObjects()
for cur in range ( num ) :
obj = node.getAttachedObject(cur)
print obj.getMovableType()
clearList.append(obj)
self._mgr.getRootSceneNode().removeAndDestroyChild(name)
self._space.removeGeometry(geom)
del body
del geom
## Remove all the entities we found attached to scene nodes we're controlling
for i in clearList:
if (i.getMovableType() == "Entity") :
print "Deleting " + str(i)
self._mgr.destroyMovableObject(i)
self._key_delay = 0.0