emscripten-core / emscripten-core/emscripten

dlmalloc in 4GB mode attempts to sbrk() in more than 3GB.

Open
#25,138 0 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

Running without the special gotcha at https://github.com/emscripten-core/emscripten/pull/25126#discussion_r2316901481 , the test `browser.test_dlmalloc_3gb` will fail.

`sbrk()` spec is clear that the parameter is supposed to be signed, with the ability to decrement memory.

But that means that in a 32-bit build one cannot use sbrk() to allocate more than 2GB at a time (but must call it twice).

In https://github.com/emscripten-core/emscripten/pull/25126 I add a new API `sbrk64()` which takes a signed 64-bit parameter even in 32-bit modes, to avoid this flaw.

But dlmalloc will still need fixing to account for this.

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.