void V8GCController::checkMemoryUsage() { #if PLATFORM(CHROMIUM) || PLATFORM(QT) const int lowMemoryUsageMB = PlatformSupport::lowMemoryUsageMB(); const int highMemoryUsageMB = PlatformSupport::highMemoryUsageMB(); const int highUsageDeltaMB = PlatformSupport::highUsageDeltaMB(); int memoryUsageMB = getMemoryUsageInMB(); if ((memoryUsageMB > lowMemoryUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highMemoryUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB)) v8::V8::LowMemoryNotification(); #endif }
void V8GCController::checkMemoryUsage() { #if PLATFORM(CHROMIUM) || PLATFORM(QT) && !OS(SYMBIAN) // These values are appropriate for Chromium only. const int lowUsageMB = 256; // If memory usage is below this threshold, do not bother forcing GC. const int highUsageMB = 1024; // If memory usage is above this threshold, force GC more aggresively. const int highUsageDeltaMB = 128; // Delta of memory usage growth (vs. last workingSetEstimateMB) to force GC when memory usage is high. #elif PLATFORM(ANDROID) // Query the PlatformBridge for memory thresholds as these vary device to device. static const int lowUsageMB = PlatformBridge::lowMemoryUsageMB(); static const int highUsageMB = PlatformBridge::highMemoryUsageMB(); static const int highUsageDeltaMB = PlatformBridge::highUsageDeltaMB(); #else return; #endif int memoryUsageMB = getMemoryUsageInMB(); if ((memoryUsageMB > lowUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB)) v8::V8::LowMemoryNotification(); }