Visual Studio reported memory leaks when I integrated OpenFBX into my hobby engine. Upon investigation, I've identified the problem.
Objects are allocated using Scene's m_allocator which releases the Object memory when a scene is destroyed, but doesn't call destructors, and therefore doesn't release memory that's allocated by objects outside of the allocator.
In particular ofbx.add() allocates GeometryImpl::NewVertex records with vanilla operator new, but because GeometryImpl's destructor is never called, these records are never deallocated.
One possible fix is to manually call object destructors in scene's destructor:
Visual Studio reported memory leaks when I integrated OpenFBX into my hobby engine. Upon investigation, I've identified the problem.
Objects are allocated using Scene's m_allocator which releases the Object memory when a scene is destroyed, but doesn't call destructors, and therefore doesn't release memory that's allocated by objects outside of the allocator.
In particular ofbx.add() allocates GeometryImpl::NewVertex records with vanilla operator new, but because GeometryImpl's destructor is never called, these records are never deallocated.
One possible fix is to manually call object destructors in scene's destructor:
I've confirmed that this fixes all outstanding memory leaks in the latest version, and Visual Studio has stopped complaining :)