[Webkit-unassigned] [Bug 260017] New: RangeError: Out of memory when creating (Shared)ArrayBuffer with big maxByteLength

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 10 00:40:27 PDT 2023


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

            Bug ID: 260017
           Summary: RangeError: Out of memory when creating
                    (Shared)ArrayBuffer with big maxByteLength
           Product: WebKit
           Version: Safari 16
          Hardware: iPhone / iPad
                OS: iOS 16
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebAssembly
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jl.public.32 at gmail.com

When creating an ArrayBuffer or SharedArrayBuffer with a small length but a large maxByteLength, for example:

  new ArrayBuffer(64 * 1024, { maxByteLength: 4 * 1024 * 1024 * 1024 })

or

  new SharedArrayBuffer(64 * 1024, { maxByteLength: 4 * 1024 * 1024 * 1024 })

a RangeError: Out of memory occurs, as if we are trying to allocate the whole 4GiB immediately.

I would expect that the buffer would initially be created successfully with 64kiB of memory, but a subsequent grow() might fail, if it exceeds available memory.

If I reduce the requested maxByteLength to e.g. 4MiB instead, it successfully creates the buffer.

I think this only occurs if the device has less memory available than the maxByteLength that we give as an argument. On the iPhone SE (2020) that I have, the exception always occurs if I request maxByteLength as 4GiB, but on the laptop it's fine, presumably because the laptop has that much memory to spare.

-- 
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/20230810/f62cfd81/attachment-0001.htm>


More information about the webkit-unassigned mailing list