Cannot allocate more than 1GB memory in WASM
Reported by
cfakhrud...@zynga.com,
Feb 6 2018
|
||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3341.0 Safari/537.36
Steps to reproduce the problem:
1. Open Developer Tools -> Console
2. Type "new WebAssembly.Memory({initial: 32767});"
3. See an error message "Uncaught RangeError: WebAssembly.Memory(): could not allocate memory"
What is the expected behavior?
Should be able to allocate upto 2GB of memory in WASM.
What went wrong?
Cannot allocate more than 1GB memory in WASM
Did this work before? Yes 64.0.3282.140 (Official Build) (64-bit)
Does this work in other browsers? Yes
Chrome version: 66.0.3341.0 Channel: canary
OS Version: OS X 10.12.6
Flash Version: 28.0.0.161
,
Feb 7 2018
,
Feb 7 2018
Able to reproduce the issue on Windows 10, mac 10.12.6 and ubuntu 14.04 using chrome reported version #66.0.3341.0. Bisect Information: ===================== Good build: 66.0.3336.0 Bad Build : 66.0.3338.0 Change Log URL: https://chromium.googlesource.com/chromium/src/+log/af540e8d369aa8105e0d4700c20f9b08dca9c3f5..eaa730ff5abd585b0b629f07406df6701589e7ff From the above change log suspecting below change Change-Id: I712176c715d1fb2511d87892052ba9d2d8084336 Reviewed-on: https://chromium-review.googlesource.com/853120 bbudge@ - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner. Note: Adding stable blocker for M-66 as it seems to be a recent regression. Please feel free to remove the same if not appropriate. Thanks...!!
,
Feb 8 2018
This is related to my change. What is happening is the memory allocation is rounded up to the nearest power of 2 which would be 0x80000000. My change adds room for a pointer to the allocation, which causes us to exceed 2 GiB which is the limit in partition_alloc. I think the simplest, safest fix is to up the limit in partition_alloc.
,
Feb 8 2018
#4: Do you mean the conceptual equivalent of: ``` kOverheadSize = sizeof(void*); // Could change later to include other stuff kMaxAllocation = 2 GiB + kOverheadSize; ``` ? That would SGTM, I think.
,
Feb 8 2018
I observed allocations of 2 GiB + metadata size + sizeof(void*). I'm not sure how this worked before.
,
Feb 8 2018
Oh and I bumped it up by a full page, since these would route through AllocPages.
,
Feb 8 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/865a289c75e6aeaeaea925b58262e7afb063e5ca commit 865a289c75e6aeaeaea925b58262e7afb063e5ca Author: Bill Budge <bbudge@chromium.org> Date: Thu Feb 08 03:45:48 2018 [partition_alloc] Increase direct mapping size limit. - Increase the limit by 1 allocated page. This is needed to hold metadata and other information for the allocation. WASM will round large memory allocations up to the next power of 2, and adding metadata will exceed the 2 GiB limit if size > 1 GiB. Bug: chromium:809586 Change-Id: I8de04bac2d2fe640c6342abed3386a6501a5fe72 Reviewed-on: https://chromium-review.googlesource.com/907855 Reviewed-by: Chris Palmer <palmer@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Commit-Queue: Bill Budge <bbudge@chromium.org> Cr-Commit-Position: refs/heads/master@{#535293} [modify] https://crrev.com/865a289c75e6aeaeaea925b58262e7afb063e5ca/base/allocator/partition_allocator/partition_alloc.cc [modify] https://crrev.com/865a289c75e6aeaeaea925b58262e7afb063e5ca/base/allocator/partition_allocator/partition_alloc.h
,
Feb 8 2018
,
Feb 9 2018
Tested this issue on Windows 10, Mac OS 10.12.6 and Ubuntu 14.04 on the latest Chrome Build 66.0.3344.0 by following the steps mentioned in the original comment.
Issue is fixed on Windows 10 and Mac OS 10.12.6, but still able to reproduce the issue on Ubuntu 14.04.
Can see memory allocated on executing the command "new WebAssembly.Memory({initial: 32767});" in Devtools -> Console in Windows 10 and Mac OS 10.12.6.
Still seeing the error message on Ubuntu 14.04 on 66.0.3344.0 build.
Attached are the screen shots for reference.
bbudge@ Can you please check and confirm the fix on Ubuntu 14.04.
Thanks..
,
Feb 9 2018
I can't reproduce on Ubuntu on a tip of tree build: Version 66.0.3343.0 (Developer Build) (64-bit) However, I wasn't able to reproduce the issue before either.
,
Feb 13 2018
The issue is also reproducible on "Google Chrome 66.0.3343.3 (Official Build) dev (64-bit) (cohort: Dev)" |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by manoranj...@chromium.org
, Feb 6 2018