Bug 65445 - JSC does a GC even when the heap still has free pages
Summary: JSC does a GC even when the heap still has free pages
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2011-07-31 21:34 PDT by Filip Pizlo
Modified: 2011-08-02 12:57 PDT (History)
4 users (show)

See Also:

the patch (4.60 KB, patch)
2011-07-31 21:53 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2011-07-31 21:34:07 PDT
The JSC GC has an elastic notion of free memory, where free blocks left over from a previous garbage collection are steadily returned to the OS provided that the application does not experience a subsequent heap usage spike that would need those blocks again.  But the GC does not leverage this as well as it could.  It separately maintains a watermark limit for invoking collection. This limit is independent of the number of free pages.  Thus, if an application experiences a memory usage peak where the heap is grown, and then memory usage dips resulting in a lower watermark, then the heap will be in the following awkward state: the free block pool will still have blocks available for immediate use in allocations, but the collector will insist on running anyway.

Ideally, the elasticity of the free block pool should be coupled to the GC's decision function for when to invoke collection, so that we don't do full collections when there is still free memory available.
Comment 1 Filip Pizlo 2011-07-31 21:53:31 PDT
Created attachment 102476 [details]
the patch
Comment 2 WebKit Review Bot 2011-08-02 12:57:20 PDT
Comment on attachment 102476 [details]
the patch

Clearing flags on attachment: 102476

Committed r92217: <http://trac.webkit.org/changeset/92217>
Comment 3 WebKit Review Bot 2011-08-02 12:57:24 PDT
All reviewed patches have been landed.  Closing bug.