[iOS] Run a full garbage collection on memory warning.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Feb 2015 03:14:22 +0000 (03:14 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Feb 2015 03:14:22 +0000 (03:14 +0000)
<https://webkit.org/b/141313>
<rdar://problem/19738024>

Reviewed by Chris Dumez.

Make sure that we run a full GC when trying to free up memory, as this might
be our last chance to execute before the kernel suspends this process.

This aligns WebKit2 with the old WebKit1 behavior.

* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::platformReleaseMemory):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179737 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm

index cfef8b3..cd5e7b6 100644 (file)
@@ -1,3 +1,20 @@
+2015-02-05  Andreas Kling  <akling@apple.com>
+
+        [iOS] Run a full garbage collection on memory warning.
+        <https://webkit.org/b/141313>
+        <rdar://problem/19738024>
+
+        Reviewed by Chris Dumez.
+
+        Make sure that we run a full GC when trying to free up memory, as this might
+        be our last chance to execute before the kernel suspends this process.
+
+        This aligns WebKit2 with the old WebKit1 behavior.
+
+        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
+        (WebCore::MemoryPressureHandler::platformReleaseMemory):
+
+
 2015-02-05  Hyungwook Lee  <hyungwook.lee@navercorp.com>
 
         Fix ASSERTION FAILED: !root->needsLayout() in FrameView::layout()
index 577220b..a3461ee 100644 (file)
@@ -59,6 +59,13 @@ void MemoryPressureHandler::platformReleaseMemory(bool)
         IOSurfacePool::sharedPool().discardAllSurfaces();
     }
 #endif
+
+#if PLATFORM(IOS)
+    {
+        ReliefLogger log("Collecting JavaScript garbage");
+        gcController().garbageCollectNow();
+    }
+#endif
 }
 
 static dispatch_source_t _cache_event_source = 0;