Joacim Persson wrote:
> While investigating this I noticed these lines in src/AIModel/AIManager.cxx
> in method ssgBranch * FGAIManager::getModel(const string& path) (line 262)
>
> ...(while iterating over all loaded models):
>        if (i->getNumRefs() == 1)
>          {
>            i = loadedModels.erase(i);
>            //cerr << "[ Deleted ]" << endl;
>          }
>        else
>          {
>            i++;
>            //cerr << endl;
>          }
>
>
> Does this mean what I think it does?: "if referenced by just one -- then
> what the heck, let's erase it!" Looking at the backtrace it seems the task
> was to add a new aircraft in the MP scene. Why erase anything.
>
> But the call to ::getModel() looks funny too: the argument is NULL
>
>
>   
We added this recently for AI traffic, in order to prevent no-longer 
used models from continuing to clutter system memory (which can be 
pretty significant for AI). This particular piece of code was added in 
FGAIManager::getModel(), because here we have one single function to 
take care of the model administration (with the intention of making the 
cach transparent to the calling function). Whenever we need a new model, 
we need to iterate through the cache list anyway, so we might just as 
well check which models are no longer needed.

The mechanism works because models with a ref-count of 1 are in fact no 
longer in use, and can therefore be deleted. I've tested this with 
(heavy) AI traffic for several weeks now, and we had it running at 
fsweekend as well, without any crashing, so I conclude that the 
mechanism itself is tight when used through the proper mechanism. It 
seems like there might be is a problem in the way the multiplayer code 
handles model administration (which would also seem from the fact that 
the argument to getModel is NULL). However, I can't check that right 
now, because my Linux box is still offline.

FWIW, Matthias mailed me offlist that the current caching mechanism will 
probably be superseded by a new built-in caching mechanism in OSG, so 
eventually, we'll probably remove our current caching mechanism.

Cheers,
Durk


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to