From Ryan Kawicki, "I found a memory leak within the Terrex plugin.

Out application has the ability to switch to different types of terrains on the fly.  This problem only exists in this type of situation.

The TXPArchive is held by the ReadWriterTXP class.  When the TXPNode, which is the top level node, is released from memory, the archive associated to that TXPNode is also released.  The issue is that the reference count on the TXPArchive never gets to zero.

The reason why the reference count never gets to zero is because the TXPParse, which is owned by the TXPArchive, stores a ref_ptr to the TXPArchive.  You can then see why this becomes a problem.  The TXPParser's ref_ptr cannot be unreferenced since the TXPArchive has not released the TXPParser.

Since the TXPParser is fully contained within the TXPArchive, I don't see the reason to have the TXPParser have a ref_ptr to the TXPArchive.  I've made this change locally and have had no problems and our memory leak has been fixed.
"
This commit is contained in:
Robert Osfield 2010-07-31 09:04:18 +00:00
parent 4e7d6cab81
commit 34e611a64c

View File

@ -302,8 +302,8 @@ protected:
bool EndChildren(void *);
// THE archive
osg::ref_ptr< TXPArchive > _archive;
TXPArchive * _archive;
// Current parent
osg::Group* _currentTop;