emscripten-core/emscripten

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

Opened this issue · 0 comments

juj commented

Running without the special gotcha at #25126 (comment) , 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 #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.