Hi,

had another look at memory consumption. The FG multiplayer (=AI)
aircraft classes seem fine - they are created/removed as expected. But
there are problems with some of our OSG-based simgear classes: they
are never removed at run-time - hence memory is eaten up.

Problems start at simgear::Effect. Their parent objects
(simgear::EffectGeode) are still removed when the related model
disappears from the scene graph. But simgear::Effect objects stick in
memory, until exiting FG. Their reference counter shows that there
must be (forgotten) references to each of them somewhere (but they are
no longer members of the scene graph). Attached is a simple patch
logging Effect constructor/destructor calls. Shows that not a single
Effect::~Effect destructor is called at run-time - though we
continuously create new objects. Effect objects own 2D textures
(images), techniques, etc - so they have considerable memory impact.

Any suggestions on how to trace the cause?

New Effect objects are created when new MP aircraft join or new
scenery areas are loaded. So, no surprise there are issues with large
MP events/long distance flights.

Another observation: I started an MP session at KSFO (lots of MP
aircraft), then warped to the middle of nowhere (no MP aircraft).
After about 30min I dumped the scene graph. Surprisingly, loads of
osg::particles were still *in* the scene graph, referring to aircraft
specific smoke and contrail textures. I would have expected them to be
dropped from the scene graph after some time - or when we move to a
very distant position. Maybe there's another issue.

For me, this is all independent from enabling/disabling the OSG cache.
But maybe it's worse now, since we have more advanced aircraft, making
more use of effects and particles. And I guess the pretty local
weather clouds also make use of these.

cheers,
Thorsten
diff --git a/simgear/scene/material/Effect.cxx b/simgear/scene/material/Effect.cxx
index 6517bd2..314d131 100644
--- a/simgear/scene/material/Effect.cxx
+++ b/simgear/scene/material/Effect.cxx
@@ -83,15 +83,19 @@ using namespace osgUtil;
 
 using namespace effect;
 
+static unsigned long EffectCount=0;
+
 Effect::Effect()
     : _cache(0), _isRealized(false)
 {
+    printf("%4lu Effect::Effect()\n",++EffectCount);
 }
 
 Effect::Effect(const Effect& rhs, const CopyOp& copyop)
     : root(rhs.root), parametersProp(rhs.parametersProp), _cache(0),
       _isRealized(rhs._isRealized)
 {
+    printf("%4lu Effect::Effect(..)\n",++EffectCount);
     typedef vector<ref_ptr<Technique> > TechniqueList;
     for (TechniqueList::const_iterator itr = rhs.techniques.begin(),
              end = rhs.techniques.end();
@@ -149,6 +153,7 @@ void Effect::releaseGLObjects(osg::State* state) const
 
 Effect::~Effect()
 {
+    printf("%4lu Effect::~Effect(..)\n",--EffectCount);
     delete _cache;
 }
 
------------------------------------------------------------------------------
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

Reply via email to