Title: [119546] trunk/Source
Revision
119546
Author
[email protected]
Date
2012-06-05 18:37:09 -0700 (Tue, 05 Jun 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=88370
Memory sampler should trigger low memory signal

Reviewed by Geoff Garen.

Source/WebCore:

No new tests. Verify by running stress test which crashes
in a few minutes without the fix.

Fix assumption in block code.  We could get in a state where timer_event_source
had already been released before the block ran.

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

Source/WebKit2:

Send low memory signal when running the memory sampler.  We'd
like to test memory that cannot be freed.

* Shared/WebMemorySampler.cpp:
(WebKit::WebMemorySampler::sampleTimerFired):
* Shared/WebMemorySampler.h:
(WebMemorySampler):
* Shared/mac/WebMemorySampler.mac.mm:
(WebKit):
(WebKit::WebMemorySampler::sendMemoryPressureEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (119545 => 119546)


--- trunk/Source/WebCore/ChangeLog	2012-06-06 01:10:49 UTC (rev 119545)
+++ trunk/Source/WebCore/ChangeLog	2012-06-06 01:37:09 UTC (rev 119546)
@@ -1,3 +1,19 @@
+2012-06-05  Stephanie Lewis  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=88370
+        Memory sampler should trigger low memory signal
+
+        Reviewed by Geoff Garen.
+
+        No new tests. Verify by running stress test which crashes 
+        in a few minutes without the fix.
+
+        Fix assumption in block code.  We could get in a state where timer_event_source
+        had already been released before the block ran.
+
+        * platform/mac/MemoryPressureHandlerMac.mm:
+        (WebCore::MemoryPressureHandler::holdOff):
+
 2012-06-05  Yoshifumi Inoue  <[email protected]>
 
         [Forms] Introduce InputNumber type as an alias of double for replacing it to Decimal

Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (119545 => 119546)


--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2012-06-06 01:10:49 UTC (rev 119545)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2012-06-06 01:37:09 UTC (rev 119546)
@@ -106,9 +106,11 @@
             dispatch_set_context(_timer_event_source, this);
             dispatch_source_set_timer(_timer_event_source, dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), DISPATCH_TIME_FOREVER, 1 * s_minimumHoldOffTime);
             dispatch_source_set_event_handler(_timer_event_source, ^{
-                dispatch_source_cancel(_timer_event_source);
-                dispatch_release(_timer_event_source);
-                _timer_event_source = 0;
+                if (_timer_event_source) {
+                    dispatch_source_cancel(_timer_event_source);
+                    dispatch_release(_timer_event_source);
+                    _timer_event_source = 0;
+                }
                 memoryPressureHandler().install();
             });
             dispatch_resume(_timer_event_source);

Modified: trunk/Source/WebKit2/ChangeLog (119545 => 119546)


--- trunk/Source/WebKit2/ChangeLog	2012-06-06 01:10:49 UTC (rev 119545)
+++ trunk/Source/WebKit2/ChangeLog	2012-06-06 01:37:09 UTC (rev 119546)
@@ -1,3 +1,21 @@
+2012-06-04  Stephanie Lewis  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=88370
+        Memory sampler should trigger low memory signal
+
+        Reviewed by Geoff Garen.
+
+        Send low memory signal when running the memory sampler.  We'd
+        like to test memory that cannot be freed.
+
+        * Shared/WebMemorySampler.cpp:
+        (WebKit::WebMemorySampler::sampleTimerFired):
+        * Shared/WebMemorySampler.h:
+        (WebMemorySampler):
+        * Shared/mac/WebMemorySampler.mac.mm:
+        (WebKit):
+        (WebKit::WebMemorySampler::sendMemoryPressureEvent):
+
 2012-06-05  Brady Eidson  <[email protected]>
 
         <rdar://problem/11575898> and https://bugs.webkit.org/show_bug.cgi?id=88372

Modified: trunk/Source/WebKit2/Shared/WebMemorySampler.cpp (119545 => 119546)


--- trunk/Source/WebKit2/Shared/WebMemorySampler.cpp	2012-06-06 01:10:49 UTC (rev 119545)
+++ trunk/Source/WebKit2/Shared/WebMemorySampler.cpp	2012-06-06 01:37:09 UTC (rev 119546)
@@ -153,7 +153,8 @@
 
 void WebMemorySampler::sampleTimerFired(Timer<WebMemorySampler>*)
 {
-    appendCurrentMemoryUsageToFile(m_sampleLogFile); 
+    sendMemoryPressureEvent();
+    appendCurrentMemoryUsageToFile(m_sampleLogFile);
 }
 
 void WebMemorySampler::stopTimerFired(Timer<WebMemorySampler>*)

Modified: trunk/Source/WebKit2/Shared/WebMemorySampler.h (119545 => 119546)


--- trunk/Source/WebKit2/Shared/WebMemorySampler.h	2012-06-06 01:10:49 UTC (rev 119545)
+++ trunk/Source/WebKit2/Shared/WebMemorySampler.h	2012-06-06 01:37:09 UTC (rev 119546)
@@ -89,6 +89,7 @@
     void sampleTimerFired(WebCore::Timer<WebMemorySampler>*);
     void stopTimerFired(WebCore::Timer<WebMemorySampler>*);
     void appendCurrentMemoryUsageToFile(WebCore::PlatformFileHandle&);
+    void sendMemoryPressureEvent();
     
     SystemMallocStats sampleSystemMalloc() const;
     size_t sampleProcessCommittedBytes() const;

Modified: trunk/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm (119545 => 119546)


--- trunk/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm	2012-06-06 01:10:49 UTC (rev 119545)
+++ trunk/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm	2012-06-06 01:37:09 UTC (rev 119546)
@@ -33,6 +33,7 @@
 #import <mach/task.h>
 #import <mach/mach_types.h>
 #import <malloc/malloc.h>
+#import <notify.h>
 #import <runtime/JSLock.h>
 #import <WebCore/JSDOMWindow.h>
 #import <wtf/CurrentTime.h>
@@ -175,8 +176,15 @@
     
     return webKitMemoryStats;
 }
-    
+ 
+void WebMemorySampler::sendMemoryPressureEvent()
+{
+    // Free memory that could be released if we needed more.
+    // We want to track memory that cannot.
+    notify_post("org.WebKit.lowMemory");
 }
 
+}
+
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to