[Webkit-unassigned] [Bug 247984] References to iframes seem do not get garbage collected

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 26 08:28:55 PDT 2023


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

--- Comment #16 from Chris Dumez <cdumez at apple.com> ---
```
for (var i = 0; i < 100000; i++) { 
    document.body.appendChild(document.createElement('iframe'));
    document.querySelector('iframe').remove();
}
```

is a tight loop. As a result, our GC wouldn't free the frames until the loop is over and we return to the runloop I believe. This is expected behavior AFAIK.

Written like this, it should avoid crazy memory growth:
```
for (var i = 0; i < 100000; i++) {
    setTimeout(() => {
        document.body.appendChild(document.createElement('iframe'));
        document.querySelector('iframe').remove();
    }, 0);
}
```

Ff the frames don't get freed after the loop though, then we have a leak. I'll verify.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230426/442e7387/attachment-0001.htm>


More information about the webkit-unassigned mailing list