-----------------------------------------------------------------------
| 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 | { |
nothing calls this directly
no test coverage detected