emscripten-core / emscripten-core/emscripten

RuntimeError: memory access out of bounds

Open
#22,041 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I am trying to compile the raytracing in a weekend which is perfectly compiling in the Xcode
Here is the link to the repo I am compiling , its a simple c++ raytracer : https://github.com/ManishJu/Raytracer_2ndWeek.git
**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.61-git
clang version 19.0.0git

**Failing command line in full:**

```
emcc main.cpp -O3 -o 1.html -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -sSTACK_SIZE=10000000 && node --node-memory-debug a.out.js
```

Here is the console log I am getting :
```

...../a.out.js:128
throw ex;
^

RuntimeError: memory access out of bounds
at wasm://wasm/001b0002:wasm-function[289]:0x37aab
at wasm://wasm/001b0002:wasm-function[272]:0x35936
at wasm://wasm/001b0002:wasm-function[123]:0xf9ec
at wasm://wasm/001b0002:wasm-function[123]:0xfa5b
at wasm://wasm/001b0002:wasm-function[123]:0xfa5b
at wasm://wasm/001b0002:wasm-function[123]:0xfa5b
at wasm://wasm/001b0002:wasm-function[123]:0xfa5b
at wasm://wasm/001b0002:wasm-function[125]:0x10242
at ..../a.out.js:641:12
at callMain ..../a.out.js:4936:15)

Node.js v22.2.0

```

The issue is similar to issue #21848 . I tried using optimisation flag and increasing stack size but with no success

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.