MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / checkUsage

Method checkUsage

OgreMain/src/OgreResourceManager.cpp:453–475  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

451 }
452 //-----------------------------------------------------------------------
453 void ResourceManager::checkUsage()
454 {
455 if( getMemoryUsage() > mMemoryBudget )
456 {
457 OGRE_LOCK_AUTO_MUTEX;
458 // unload unreferenced resources until we are within our budget again
459 ResourceMap::iterator i, iend;
460 iend = mResources.end();
461 for( i = mResources.begin(); i != iend && getMemoryUsage() > mMemoryBudget; ++i )
462 {
463 // A use count of 3 means that only RGM and RM have references
464 // RGM has one (this one) and RM has 2 (by name and by handle)
465 if( i->second.use_count() == ResourceGroupManager::RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS )
466 {
467 Resource *res = i->second.get();
468 if( res->isReloadable() )
469 {
470 res->unload();
471 }
472 }
473 }
474 }
475 }
476 //-----------------------------------------------------------------------
477 void ResourceManager::_notifyResourceTouched( Resource *res )
478 {

Callers

nothing calls this directly

Calls 6

getMemoryUsageFunction · 0.85
isReloadableMethod · 0.80
endMethod · 0.45
beginMethod · 0.45
getMethod · 0.45
unloadMethod · 0.45

Tested by

no test coverage detected