Title: [166953] trunk/Source/WebCore
Revision
166953
Author
akl...@apple.com
Date
2014-04-08 13:26:54 -0700 (Tue, 08 Apr 2014)

Log Message

[Mac] Always do a full GC when simulating memory pressure.
<https://webkit.org/b/129790>

To get more consistent accounting on automated memory testers,
add a synchronous GC as part of the simulated memory pressure event.

Reviewed by Geoffrey Garen.

* platform/mac/MemoryPressureHandlerMac.mm:
(WebCore::MemoryPressureHandler::install):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (166952 => 166953)


--- trunk/Source/WebCore/ChangeLog	2014-04-08 20:25:34 UTC (rev 166952)
+++ trunk/Source/WebCore/ChangeLog	2014-04-08 20:26:54 UTC (rev 166953)
@@ -1,3 +1,16 @@
+2014-04-08  Andreas Kling  <akl...@apple.com>
+
+        [Mac] Always do a full GC when simulating memory pressure.
+        <https://webkit.org/b/129790>
+
+        To get more consistent accounting on automated memory testers,
+        add a synchronous GC as part of the simulated memory pressure event.
+
+        Reviewed by Geoffrey Garen.
+
+        * platform/mac/MemoryPressureHandlerMac.mm:
+        (WebCore::MemoryPressureHandler::install):
+
 2014-04-08  Jer Noble  <jer.no...@apple.com>
 
         Unreviewed iOS build fix. Pass 0 instead of nil to setRate: when pausing.

Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (166952 => 166953)


--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2014-04-08 20:25:34 UTC (rev 166952)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2014-04-08 20:26:54 UTC (rev 166953)
@@ -29,6 +29,7 @@
 #if !PLATFORM(IOS)
 
 #import "IOSurfacePool.h"
+#import "GCController.h"
 #import "LayerPool.h"
 #import "WebCoreSystemInterface.h"
 #import <malloc/malloc.h>
@@ -70,6 +71,11 @@
 
     // Allow simulation of memory pressure with "notifyutil -p org.WebKit.lowMemory"
     notify_register_dispatch("org.WebKit.lowMemory", &_notifyToken, dispatch_get_main_queue(), ^(int) {
+
+        // We only do a synchronous GC when *simulating* memory pressure.
+        // This gives us a more consistent picture of live objects at the end of testing.
+        gcController().garbageCollectNow();
+
         memoryPressureHandler().respondToMemoryPressure();
         malloc_zone_pressure_relief(nullptr, 0);
     });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to