emscripten-core / emscripten-core/emscripten

wasm64: bufferSubData fails after heap grows beyond 4 GB

Open
#20,517 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

**Version of emscripten/emsdk:**
```sh
|-> $ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.47 (431685f05c67f0424c11473cc16798b9587bb536)
clang version 18.0.0 (https://github.com/llvm/llvm-project 21030b9ab4487d845e29792063f5666d8c4b8e09)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/local/KHQ/jaswant.panchumarti/Documents/code/ansys/vtk-wasm-memory-branch/emsdk/upstream/bin
```

Error:
```js
Uncaught (in promise) TypeError: Failed to execute 'bufferSubData' on 'WebGL2RenderingContext': parameter 3 is not of type 'ArrayBufferView'.
at _glBufferSubData (vtkWasmRendererApplication.js:7581:17)
```

From debugger, it looks like HEAPU8 is a proxy object due to changes introduced by https://github.com/emscripten-core/emscripten/pull/19737. What is the approach to make the proxy recognizable by `bufferSubData`?

![heap-beyond-4gb-in-buffer-sub-data](https://github.com/emscripten-core/emscripten/assets/40538987/a99ddeec-99fa-43f3-b699-df8fefdb5c24)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.