Bug 111605 - [Qt] QWebSettings::clearMemoryCaches should release FastMalloc's free pages to OS
Summary: [Qt] QWebSettings::clearMemoryCaches should release FastMalloc's free pages t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Major
Assignee: Nobody
URL:
Keywords: EasyFix
Depends on: 111094
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-06 11:30 PST by Arunprasad
Modified: 2013-03-08 05:46 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.84 KB, patch)
2013-03-07 10:49 PST, Arunprasad Rajkumar
no flags Details | Formatted Diff | Diff
#include <wtf/Functional.h> inclusion is not needed (1.81 KB, patch)
2013-03-07 10:55 PST, Arunprasad Rajkumar
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arunprasad 2013-03-06 11:30:10 PST
Should behave like MemoryPressureHandler::releaseMemory @ MemoryPressureHandlerMac.mm.

 +    WebCore::StorageThread::releaseFastMallocFreeMemoryInAllThreads();
 +#if ENABLE(WORKERS)
 +    WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads();
 +#endif
 +    WTF::releaseFastMallocFreeMemory();
Comment 1 Arunprasad 2013-03-07 10:35:55 PST
WTF's FastMalloc(TCMalloc) logic implements memory management which is optimized for faster allocation and release. FastMalloc maintains free-list for each thread and one central list per process to avoid semaphore locking overhead(lock contention). Periodically thread specific free blocks will be moved to central free-list then it will be released back to system using special thread named "scavenger".

Incase of memory pressure free-blocks scattered around threads should be released back to OS, so that other processes can use the memory. 

So modifying QWebSettings::clearMemoryCaches to call FastMalloc's page release functions.

I will upload the patch soon.
Comment 2 Arunprasad Rajkumar 2013-03-07 10:49:09 PST
Created attachment 192045 [details]
Patch
Comment 3 Arunprasad Rajkumar 2013-03-07 10:55:58 PST
Created attachment 192046 [details]
#include <wtf/Functional.h> inclusion is not needed
Comment 4 Jocelyn Turcotte 2013-03-08 05:22:40 PST
Comment on attachment 192046 [details]
#include <wtf/Functional.h> inclusion is not needed

r=me
Comment 5 WebKit Review Bot 2013-03-08 05:45:59 PST
Comment on attachment 192046 [details]
#include <wtf/Functional.h> inclusion is not needed

Clearing flags on attachment: 192046

Committed r145211: <http://trac.webkit.org/changeset/145211>
Comment 6 WebKit Review Bot 2013-03-08 05:46:03 PST
All reviewed patches have been landed.  Closing bug.