> This doesn't happen for static variables nor for data members. I'd > assume that in case of SGReferenced objects, the same explicit delete is > necessary to decrement the reference counter. Isn't that what SGReferenced objects were made for? Automatic deletion? Minimal but slight more complex example
class MyReferenced : public SGReferenced { public: MyReferenced( int id ); virtual ~ MyReferenced(); private: int _id; }; MyReferenced::MyReferenced( int id ) : _id(id) { std::cerr << "MyReferenced(" << _id << ") constructed" << std::endl; } MyReferenced::~MyReferenced() { std::cerr << "MyReferenced(" << _id << ") destructed" << std::endl; } int main(int argc, char **argv ) { std::vector<SGSharedPtr<MyReferenced> > v; std::cerr << "Adding first" << std::endl; v.push_back(new MyReferenced(1)); std::cerr << "Adding second" << std::endl; v.push_back(new MyReferenced(2)); std::cerr << "Clearing Vector" << std::endl; v.clear(); std::cerr << "Exiting" << std::endl; return 0; } Creates output as expected: Adding first MyReferenced(1) constructed Adding second MyReferenced(2) constructed Clearing Vector MyReferenced(1) destructed MyReferenced(2) destructed Exiting And without the explicit clear(), it looks right, too: Adding first MyReferenced(1) constructed Adding second MyReferenced(2) constructed Exiting MyReferenced(1) destructed MyReferenced(2) destructed > In any case, the static variables and probably the complete autopilot > are only destroyed at program end, so fixing these leaks won't have an > influence on the growing memory footprint at runtime. I just mentioned > them because they were the only ones where I thought an easy fix to be > possible. Which is very much appreciated. It's just to easy to overlook something. Torsten ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel