| Summary: | img elements with loading=“lazy” that are not visible are not getting garbage collected | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Kin Blas <jblas> | ||||||
| Component: | Images | Assignee: | Przemyslaw Gorszkowski <pgorszkowski> | ||||||
| Status: | RESOLVED DUPLICATE | ||||||||
| Severity: | Normal | CC: | jblas, pgorszkowski, sabouhallawa, simon.fraser, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | Mac (Apple Silicon) | ||||||||
| OS: | macOS 13 | ||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=263521 | ||||||||
| Attachments: |
|
||||||||
|
Description
Kin Blas
2023-09-27 20:07:31 PDT
Created attachment 467913 [details]
All-in-One test case that illustrates the img loading="lazy" retainer issue
Added an All-in-One test case that illustrates the img loading="lazy" retainer issue
Created attachment 467914 [details]
Video demonstrating the img loading="lazy" retainer issue
Attaching a sample video demonstrating the img loading="lazy" retainer issue
One more observation I probably should've mentioned. This retainer issue doesn't happen if the img is a direct descendant of the scrolling element, there has to be an intermediate ancestor between the scrolling element and the img. It seems to be the same problem reported in https://bugs.webkit.org/show_bug.cgi?id=263521 Are you able to check the proposed solution in that report on Safari? diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp index 3e4855fd20e2..5ddc923b1568 100644 --- a/Source/WebCore/html/HTMLImageElement.cpp +++ b/Source/WebCore/html/HTMLImageElement.cpp @@ -514,6 +518,8 @@ void HTMLImageElement::removedFromAncestor(RemovalType removalType, ContainerNod selectImageSource(RelevantMutation::Yes); } + m_imageLoader->clearImage(); + HTMLElement::removedFromAncestor(removalType, oldParentOfRemovedTree); FormAssociatedElement::elementRemovedFromAncestor(*this, removalType); } Thanks *** This bug has been marked as a duplicate of bug 263521 *** |