[Webkit-unassigned] [Bug 281662] New: Transferring buffers to a closed MessageChannel causes memory leaks in Safari Networking

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 17 04:10:14 PDT 2024


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

            Bug ID: 281662
           Summary: Transferring buffers to a closed MessageChannel causes
                    memory leaks in Safari Networking
           Product: WebKit
           Version: Safari 18
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ivan.curic at gmail.com

const { port1, port2 } = new MessageChannel();
port2.close();

port1.postMessage(e.data, [e.data.imageData.data.buffer]);

This approach can be used to alleviate memory pressure in V8 as it forces GC.

When used in Safari, this memory never gets GC'd, and the leak happens in the "Safari Networking" process for some reason, and can't be reclaimed until you restart Safari.
You can't find this leak in the Web Inspector.

Repro:

Enable the option "Toss transferable to empty MessageChannel" and observe memory usage in Activity Monitor

https://imagedata-worker-leak.netlify.app/
https://github.com/ivancuric/memory-leak-repro

-- 
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/20241017/858d3a23/attachment.htm>


More information about the webkit-unassigned mailing list