emscripten-core / emscripten-core/emscripten

Memory grows each time the page refresh until error appear : Uncaught RangeError: WebAssembly.Memory(): could not allocate memory

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

Description

Hi community :)
I get an error after several refresh : Uncaught RangeError: WebAssembly.Memory(): could not allocate memory.

When I go to "inspect > memory > Select Javascript VM instance", memory grows each time I refresh the page.
When memory is bigger than 40mo, the error appear.
How can I clear memory on refresh page ?
The memory should not be deleted automatically ?

My code :
`extern \"C\" {

void EMSCRIPTEN_KEEPALIVE gl() {

// set size of viewport
glViewport(0, 0, 800, 600);

}

int EMSCRIPTEN_KEEPALIVE main() {
// insert code here...
emscripten_log(EM_LOG_CONSOLE, "hello world \n");
return 0;
};

}`

My terminal cmd :
`main.cpp -Os -std=c++17 -s USE_WEBGL2=1 -o main.html`

Thanks in advance for your help ;)

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.