Bug 111605

Summary: [Qt] QWebSettings::clearMemoryCaches should release FastMalloc's free pages to OS
Product: WebKit Reporter: Arunprasad <ararunprasad>
Component: WebKit QtAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: allan.jensen, arurajku, jbriance, webkit.review.bot
Priority: P2 Keywords: EasyFix
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 111094    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
#include <wtf/Functional.h> inclusion is not needed none

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.