Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 844d96738a70e37b0056ef8aaaf7a0df440742ee
https://github.com/WebKit/WebKit/commit/844d96738a70e37b0056ef8aaaf7a0df440742ee
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-06 (Sun, 06 Sep 2026)
Changed paths:
M Source/WebCore/html/canvas/CanvasRenderingContext.cpp
Log Message:
-----------
CanvasRenderingContext::updateMemoryCost() reports absolute cost instead of
the delta, inflating GC pressure
https://bugs.webkit.org/show_bug.cgi?id=323411
rdar://186644499
Reviewed by Gerald Squelart.
updateMemoryCost() is called repeatedly over a context's lifetime -- on
every WebGL buffer/texture allocation and on every GPUCanvasContext frame
present, among others. Each call passed the new *absolute* memory cost to
Heap::reportExtraMemoryAllocated(), whose argument accumulates into the
"bytes allocated since last GC" counter (via didAllocate()) that drives
collectIfNecessaryOrDefer().
Passing the absolute cost means a context that grows from 100MB to 110MB
reports 100MB then 110MB -- 210MB of "allocation" for 110MB actually
resident -- so the heap sees far more allocation than really happened and
schedules GC more aggressively than warranted. The function already
computes oldMemoryCost (and uses it correctly for the Inspector
didChangeCanvasMemory diff); it should report only the positive delta to
the heap.
* Source/WebCore/html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::updateMemoryCost const):
Canonical link: https://commits.webkit.org/320597@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications