[Qt] QWebSettings::clearMemoryCaches should release FastMalloc's free pages to OS
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Mar 2013 13:43:50 +0000 (13:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Mar 2013 13:43:50 +0000 (13:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=111605

Patch by Arunprasad Rajkumar <arunprasadr@nds.com> on 2013-03-08
Reviewed by Jocelyn Turcotte.

* Api/qwebsettings.cpp:
(QWebSettings::clearMemoryCaches):

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

Source/WebKit/qt/Api/qwebsettings.cpp
Source/WebKit/qt/ChangeLog

index b30acc5..5d2ecee 100644 (file)
@@ -43,6 +43,8 @@
 #include "PluginDatabase.h"
 #include "RuntimeEnabledFeatures.h"
 #include "Settings.h"
+#include "StorageThread.h"
+#include "WorkerThread.h"
 #include <QDir>
 #include <QFileInfo>
 #include <QFont>
@@ -51,6 +53,7 @@
 #include <QSharedData>
 #include <QStandardPaths>
 #include <QUrl>
+#include <wtf/FastMalloc.h>
 #include <wtf/text/WTFString.h>
 
 
@@ -845,6 +848,13 @@ void QWebSettings::clearMemoryCaches()
     WebCore::gcController().discardAllCompiledCode();
     // Garbage Collect to release the references of CachedResource from dead objects.
     WebCore::gcController().garbageCollectNow();
+
+    // FastMalloc has lock-free thread specific caches that can only be cleared from the thread itself.
+    WebCore::StorageThread::releaseFastMallocFreeMemoryInAllThreads();
+#if ENABLE(WORKERS)
+    WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads();
+#endif
+    WTF::releaseFastMallocFreeMemory();        
 }
 
 /*!
index 518b283..d12d203 100644 (file)
@@ -1,3 +1,13 @@
+2013-03-08  Arunprasad Rajkumar  <arunprasadr@nds.com>
+
+        [Qt] QWebSettings::clearMemoryCaches should release FastMalloc's free pages to OS
+        https://bugs.webkit.org/show_bug.cgi?id=111605
+
+        Reviewed by Jocelyn Turcotte.
+
+        * Api/qwebsettings.cpp:
+        (QWebSettings::clearMemoryCaches):
+
 2013-03-07  Arunprasad Rajkumar  <arunprasadr@nds.com>
 
         [Qt] QWebSettings::clearMemoryCaches should clear JS garbage