Friday, 21 September 2018

Why can't I construct `WebAssembly.Memory` in browsers?

I've stumbled across some weird behavior in all browsers I've tried:

  • Chromium 69.0.3497.92 (Official Build) Arch Linux (64-bit)
  • Chrome 69.0.3497.100 (Official Build) (64-bit)
  • Firefox 62.0 (64-bit)

When I try to allocate memory for WebAssembly by instantiating a WebAssembly.Memory object, for example like this:

new WebAssembly.Memory({ initial: 1 })

In Chrome/Chromium, I get:

VM274:1 Uncaught RangeError: WebAssembly.Memory(): could not allocate memory
    at <anonymous>:1:1
(anonymous) @ VM274:1

And in Firefox, I get:

Error: out of memory 

The allocation works just fine in Node.js, but for some reason, all my browsers fail here. I'm not sure what to do, and all sites that depend on WebAssembly have since become unusable for me.

I suspect Linux is preventing the browsers (but not node.js?) from allocating the memory, but that's just a wild guess. A near identical installation on another computer works just fine, but on this particular machine, every allocation from a browser fails.

Does anyone know what's going on?

Here's my output of ulimit -a:

-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         unlimited
-m: resident set size (kbytes)      unlimited
-u: processes                       31215
-n: file descriptors                1024
-l: locked-in-memory size (kbytes)  16384
-v: address space (kbytes)          8388608
-x: file locks                      unlimited
-i: pending signals                 31215
-q: bytes in POSIX msg queues       819200
-e: max nice                        0
-r: max rt priority                 99
-N 15:                              unlimited



from Why can't I construct `WebAssembly.Memory` in browsers?

No comments:

Post a Comment