Title: [165292] trunk/Source
- Revision
- 165292
- Author
- [email protected]
- Date
- 2014-03-07 14:16:00 -0800 (Fri, 07 Mar 2014)
Log Message
[Mac] Notify system malloc of fake memory pressure.
<https://webkit.org/b/129908>
Source/WebCore:
After fixing the leak in r165252, I was surprised to find that it didn't
show up on memory test bots. It turns out that while the memory is now
getting freed, the system malloc implementation doesn't actually release
pages back to the OS until there is memory pressure.
Since we are just faking the memory pressure on bots, we have to let
system malloc in on the fun, so we can get representative numbers.
With this change, we should finally see the effect of not leaking the
URLRequest object tree.
Reviewed by Anders Carlsson.
* platform/mac/MemoryPressureHandlerMac.mm:
(WebCore::MemoryPressureHandler::install):
Tell system malloc that we are under fake memory pressure.
Source/WebKit2:
Reviewed by Anders Carlsson.
* NetworkProcess/mac/NetworkProcessMac.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
Listen for the fake memory pressure notification and respond by
just forwarding to system malloc. We don't do the full WebCore
memory pressure handling here, since that will cause stuff that
the network process doesn't need to get instantiated.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (165291 => 165292)
--- trunk/Source/WebCore/ChangeLog 2014-03-07 22:06:57 UTC (rev 165291)
+++ trunk/Source/WebCore/ChangeLog 2014-03-07 22:16:00 UTC (rev 165292)
@@ -1,3 +1,25 @@
+2014-03-07 Andreas Kling <[email protected]>
+
+ [Mac] Notify system malloc of fake memory pressure.
+ <https://webkit.org/b/129908>
+
+ After fixing the leak in r165252, I was surprised to find that it didn't
+ show up on memory test bots. It turns out that while the memory is now
+ getting freed, the system malloc implementation doesn't actually release
+ pages back to the OS until there is memory pressure.
+
+ Since we are just faking the memory pressure on bots, we have to let
+ system malloc in on the fun, so we can get representative numbers.
+ With this change, we should finally see the effect of not leaking the
+ URLRequest object tree.
+
+ Reviewed by Anders Carlsson.
+
+ * platform/mac/MemoryPressureHandlerMac.mm:
+ (WebCore::MemoryPressureHandler::install):
+
+ Tell system malloc that we are under fake memory pressure.
+
2014-03-07 Benjamin Poulain <[email protected]>
[iOS] WebKit1 scroll position is incorrect
Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (165291 => 165292)
--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2014-03-07 22:06:57 UTC (rev 165291)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2014-03-07 22:16:00 UTC (rev 165292)
@@ -39,6 +39,7 @@
#import <wtf/CurrentTime.h>
#import <wtf/FastMalloc.h>
#import <wtf/Functional.h>
+#import <malloc/malloc.h>
#if !PLATFORM(IOS)
#import "WebCoreSystemInterface.h"
@@ -85,6 +86,7 @@
notify_register_dispatch("org.WebKit.lowMemory", &_notifyToken, dispatch_get_main_queue(), ^(int) {
memoryPressureHandler().respondToMemoryPressure();
gcController().garbageCollectSoon();
+ malloc_zone_pressure_relief(nullptr, 0);
});
m_installed = true;
Modified: trunk/Source/WebKit2/ChangeLog (165291 => 165292)
--- trunk/Source/WebKit2/ChangeLog 2014-03-07 22:06:57 UTC (rev 165291)
+++ trunk/Source/WebKit2/ChangeLog 2014-03-07 22:16:00 UTC (rev 165292)
@@ -1,3 +1,18 @@
+2014-03-07 Andreas Kling <[email protected]>
+
+ [Mac] Notify system malloc of fake memory pressure.
+ <https://webkit.org/b/129908>
+
+ Reviewed by Anders Carlsson.
+
+ * NetworkProcess/mac/NetworkProcessMac.mm:
+ (WebKit::NetworkProcess::platformInitializeNetworkProcess):
+
+ Listen for the fake memory pressure notification and respond by
+ just forwarding to system malloc. We don't do the full WebCore
+ memory pressure handling here, since that will cause stuff that
+ the network process doesn't need to get instantiated.
+
2014-03-07 Dean Jackson <[email protected]>
Attempt to fix the iOS build.
Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkProcessMac.mm (165291 => 165292)
--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkProcessMac.mm 2014-03-07 22:06:57 UTC (rev 165291)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkProcessMac.mm 2014-03-07 22:16:00 UTC (rev 165292)
@@ -42,6 +42,8 @@
#import <mach/host_info.h>
#import <mach/mach.h>
#import <mach/mach_error.h>
+#import <malloc/malloc.h>
+#import <notify.h>
#import <sysexits.h>
#import <wtf/text/WTFString.h>
@@ -112,6 +114,11 @@
void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
{
+ static int notifyToken;
+ notify_register_dispatch("org.WebKit.lowMemory", ¬ifyToken, dispatch_get_main_queue(), ^(int) {
+ malloc_zone_pressure_relief(nullptr, 0);
+ });
+
m_diskCacheDirectory = parameters.diskCacheDirectory;
if (!m_diskCacheDirectory.isNull()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes