Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4de86938e79075f116c0f431986f7853dd8c281
      
https://github.com/WebKit/WebKit/commit/a4de86938e79075f116c0f431986f7853dd8c281
  Author: Cameron McCormack <[email protected]>
  Date:   2026-09-21 (Mon, 21 Sep 2026)

  Changed paths:
    M LayoutTests/fast/images/imagebitmap-memory.html
    M LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/testing/MemoryInfo.h
    M Source/WebCore/testing/MemoryInfo.idl

  Log Message:
  -----------
  Eliminate fast/images/imagebitmap-memory.html flakiness by measuring heap 
size immediately after a full collection takes place
https://bugs.webkit.org/show_bug.cgi?id=300337
rdar://161869868

Reviewed by Kimmo Kinnunen.

The test created 200 ImageBitmaps and then required the growth in
internals.memoryInfo().usedJSHeapSize to stay under 400 MB, taking that as
evidence that GC had collected them.

usedJSHeapSize is commonVM().heap.size() + Heap::m_extraMemorySize.
m_extraMemorySize is only cleared on a full collection, not an eden
collection. usedJSHeapSize grows until a full collection has taken
place, and so over the course of the test loop, it will show a sawtooth
behavior where it grows with each allocated ImageBitmap and then drops
when a full collection is taken.

After the 200 rounds, there's no guarantee of where in the sawtooth
behavior that usedJSHeapSize will be sampled. Sometimes it is sampled
near the top, and the test fails since heapUsed is more than 400 MB.

Expose and use Heap::sizeAfterLastFullCollection to get the heap size
right after a full collection happens. Loop allocating ImageBitmap
objects until the full collection happens.

* LayoutTests/fast/images/imagebitmap-memory.html:
* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/testing/MemoryInfo.h:
(WebCore::MemoryInfo::usedJSHeapSizeAfterLastFullCollection const):
(WebCore::MemoryInfo::MemoryInfo):
* Source/WebCore/testing/MemoryInfo.idl:

Canonical link: https://commits.webkit.org/321510@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to