コード例 #1
0
        public static long EstimatedCacheSize([email protected]_Visitable baseMemory, params [email protected]_Visitable[] memoryUsers)
        {
            long neoStoreSize    = totalMemoryUsageOf(baseMemory);
            long importCacheSize = highestMemoryUsageOf(memoryUsers);

            return(neoStoreSize + DefensivelyPadMemoryEstimate(importCacheSize));
        }
コード例 #2
0
        internal virtual void SanityCheck([email protected]_Estimates inputEstimates, RecordFormats recordFormats, [email protected]_Visitable baseMemory, params [email protected]_Visitable[] memoryVisitables)
        {
            // At this point in time the store hasn't started so it won't show up in free memory reported from OS,
            // i.e. we have to include it here in the calculations.
            long estimatedCacheSize     = estimatedCacheSize(baseMemory, memoryVisitables);
            long freeMemory             = _freeMemoryLookup.AsLong;
            long optimalMinimalHeapSize = optimalMinimalHeapSize(inputEstimates, recordFormats);
            long actualHeapSize         = _actualHeapSizeLookup.AsLong;
            bool freeMemoryIsKnown      = freeMemory != VALUE_UNAVAILABLE;

            // Check if there's enough memory for the import
            if (freeMemoryIsKnown && actualHeapSize + freeMemory < estimatedCacheSize + optimalMinimalHeapSize)
            {
                _monitor.insufficientAvailableMemory(estimatedCacheSize, optimalMinimalHeapSize, freeMemory);
                return;                         // there's likely not available memory, no need to warn about anything else
            }

            // Check if the heap is big enough to handle the import
            if (actualHeapSize < optimalMinimalHeapSize)
            {
                _monitor.insufficientHeapSize(optimalMinimalHeapSize, actualHeapSize);
                return;                         // user have been warned about heap size issue
            }

            // Check if heap size could be tweaked
            if ((!freeMemoryIsKnown || freeMemory < estimatedCacheSize) && actualHeapSize > optimalMinimalHeapSize * 1.2)
            {
                _monitor.abundantHeapSize(optimalMinimalHeapSize, actualHeapSize);
            }
        }