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

Method checkCacheFreeMemoryIsGoodEnough

Engine/AppManager.cpp:2851–2870  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2849}
2850
2851void
2852AppManager::checkCacheFreeMemoryIsGoodEnough()
2853{
2854 ///Before allocating the memory check that there's enough space to fit in memory
2855 size_t systemRAMToKeepFree = getSystemTotalRAM() * appPTR->getCurrentSettings()->getUnreachableRamPercent();
2856 size_t totalFreeRAM = getAmountFreePhysicalRAM();
2857
2858 while (totalFreeRAM <= systemRAMToKeepFree) {
2859#ifdef NATRON_DEBUG_CACHE
2860 qDebug() << "Total system free RAM is below the threshold:" << printAsRAM(totalFreeRAM)
2861 << ", clearing least recently used NodeCache image...";
2862#endif
2863 if ( !_imp->_nodeCache->evictLRUInMemoryEntry() ) {
2864 break;
2865 }
2866
2867
2868 totalFreeRAM = getAmountFreePhysicalRAM();
2869 }
2870}
2871
2872void
2873AppManager::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