* Curtis L. Olson -- Sunday 26 February 2006 07:13:
> Melchior FRANZ wrote:
> > Is everyone aware that we *never* free model branches? 

> The original design of the scenery pager would delete these objects.  
> What are you seeing that leads you to believe they aren't getting 
> deleted?  It's very plausible that something got broke along the way.

Could have been introduced recently with ssgSharedPtr<>. Around
the time when we got random objects it was desirable not to have
thousand separate tree objects etc. in memory. So the
SGModelLib::load_model() function was introduced. It holds all
models in a map<string path, ssgSharedPtr<ssgEntity>>. The objects
are removed from the scenegraph when the tile is freed, but because
we still hold the refcounted model branches in this map, they are
*not* freed.

And this is not just a theory: I was actually about to add Nasal
support to static objects. This wasn't meant to be used for trees
or other frequent models, but for landmarks with special needs.
(Example: Eiffel Tower lighting, Roberto's Space Needle, etc.)
And, of course, the Nasal contexts would have to get destroyed
once the model is removed from memory, so that they wouldn't
accumulate. But my Nasal destructors were never called. Only
when I modified my fgfs copy to only cache OBJECT_SHARED and
random objects, but not OBJECT_STATIC, would it free the models.

m.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to