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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 20 02:55:06 PST 2023


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

Mark <magranat at yandex-team.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |magranat at yandex-team.ru

--- Comment #8 from Mark <magranat at yandex-team.ru> ---
The bug with memory (In reply to Yusuke Suzuki from comment #7)
> <!DOCTYPE html>
> <html lang="en">
> 
> <head>
>     <button onclick="allocate_memory();">
>         Allocate Memory
>     </button>
>     <p>Memory bytes: </p>
>     <p id="memory_text">65536</p>
> </head>
> 
> <script>
>     let ctx = {
>       memory: new WebAssembly.Memory({
>         initial: 1,
>       })
>     };
>     const bytesPerPage = 64 * 1024;
>     function allocate_memory() {
>         let memory = ctx.memory;
>         memory.grow(1000);
>         document.getElementById("memory_text").innerHTML =
> memory.buffer.byteLength;
>     }
> </script>
> 
> Yeah, allocate_memory function in the global variable, and it is capturing
> WebAssembly.Memory. So, so long as iframe is alive, then WebAssembly.Memory
> is also alive.

(In reply to Yusuke Suzuki from comment #6)
> (In reply to dmt021 from comment #5)
> > (In reply to Yusuke Suzuki from comment #4)
> > > (In reply to Alex Christensen from comment #3)
> > > > Mark reported that WebAssembly.Memory does have a similar issue unique to
> > > > WebKit.  It's possible we're missing a call to reportExtraMemoryAllocated or
> > > > something in that case.
> > > 
> > > WebAssembly.Memory already has this. And I cannot reproduce this issue.
> > > 
> > >  for (var i = 0; i < 1000000; i++) { new WebAssembly.Memory({ initial: 1024
> > > }); }
> > > 
> > > Just works as the same way to `new ArrayBuffer` one.
> > 
> > https://dmt021.github.io/grow_index.html
> > Sample with WebAssembly.Memory leak
> > Basic flow:
> > 1. alloc WebAssembly.Memory within the iframe
> > 2. delete iframe from the main frame
> 
> This means that iframe is alive and WebAssembly.Memory is kept alive. Not
> particularly related to WebAssembly.Memory implementation.

How it could be alive, if we create and delete it?

-- 
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/20230120/b86b69a1/attachment-0001.htm>


More information about the webkit-unassigned mailing list