| 2849 | } |
| 2850 | |
| 2851 | void |
| 2852 | AppManager::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 | |
| 2872 | void |
| 2873 | AppManager::onOCIOConfigPathChanged(const std::string& path) |
no test coverage detected