[Webkit-unassigned] [Bug 90622] blockfreeing thread doesn't need to wake up every 1 second

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 5 11:45:18 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=90622





--- Comment #4 from Yong Li <yoli at rim.com>  2012-07-05 11:45:18 PST ---
(In reply to comment #3)
> Yeah, it's only to tell the thread to quit, not to wake it up.  The block freeing thread in our GC uses exponential decay.  Once a second it frees half the available blocks.  But there's more: if there was an allocation during the last second then it just waits another second.  So the one second wait is quite necessary for the algorithm to work as intended.  That's not to say that's the best way to free blocks, but it works well, if you consider the requirements: 1) you don't ever want the block freeing thread to free all available blocks all at once because there's always the chance that the main thread will want to allocate blocks in the near future, and there's no way to predict when or if that will happen since it depends on user actions, 2) you want all blocks to be returned to the OS eventually if the browser has gone idle, and 3) you don't want the communication between the main thread and the block freeing thread to involve heavy locks.  The timeout is the best way 
 to achieve all of these goals, since it means that even if the browser goes idle for a few seconds, there will still likely be some small number of free blocks left.  In that way, the GC can adapt to whatever level of activity the user imposes.

Wow. Thanks for this very helpful explanation. I was thinking that we could increase the timeout a little bit when there is no free block found. But it seems unnecessary for now and will complicate the code.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list