MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / checkCacheFreeMemoryIsGoodEnough

Method checkCacheFreeMemoryIsGoodEnough

Engine/AppManager.cpp:2789–2808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2787}
2788
2789void
2790AppManager::checkCacheFreeMemoryIsGoodEnough()
2791{
2792 ///Before allocating the memory check that there's enough space to fit in memory
2793 size_t systemRAMToKeepFree = getSystemTotalRAM() * appPTR->getCurrentSettings()->getUnreachableRamPercent();
2794 size_t totalFreeRAM = getAmountFreePhysicalRAM();
2795
2796 while (totalFreeRAM <= systemRAMToKeepFree) {
2797#ifdef NATRON_DEBUG_CACHE
2798 qDebug() << "Total system free RAM is below the threshold:" << printAsRAM(totalFreeRAM)
2799 << ", clearing least recently used NodeCache image...";
2800#endif
2801 if ( !_imp->_nodeCache->evictLRUInMemoryEntry() ) {
2802 break;
2803 }
2804
2805
2806 totalFreeRAM = getAmountFreePhysicalRAM();
2807 }
2808}
2809
2810void
2811AppManager::onOCIOConfigPathChanged(const std::string& path)

Callers 1

createInternalMethod · 0.80

Calls 6

getSystemTotalRAMFunction · 0.85
getAmountFreePhysicalRAMFunction · 0.85
printAsRAMFunction · 0.85
getCurrentSettingsMethod · 0.80
evictLRUInMemoryEntryMethod · 0.80

Tested by

no test coverage detected