Cumulative fps reduction: holding resources?


I’m having a bizarre problem wherein my fps decreases significantly during the course of the day. I can recover only by rebooting my machine, after which my fps returns to its original rate. (I’m pretty sure I’m not imagining this–my scene graph isn’t changing much and the effect is pretty pronounced.) Am I failing to release COM resources or something?


Are you perhaps leaking memory by not releasing handles to object, or by creating circular references that prevent garbage collection?

For example, NodePaths have a PythonTag attribute. When creating collision geometry, one sometimes has something like the following:

class MyClass():
    def __init__(self):
        self.collider = NodePath(PandaNode("collider"))
        # Code to set up the collider, attach it to the scene graph, etc.
        self.collider.setPythonTag("owner", self) # This should allow us to access our custom class from a collision callback

We now have a circular reference: collider references the MyClass object which references collider… As a result, there is always a reference to both and it may be that neither are garbage collected.

You should use PStats to find out what the problem is. Look at the number of batches, and the number of state changes, and the memory usage - do any of these increase during the course of the day?