# Use \`mmap\` \`std.heap.page_allocator\` impl when compiling for Wasm \+ libc · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/c9fa8e46df21cdf66b291fb3dfdcef1b6a1d3cab)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: c9fa8e46df21cdf66b291fb3dfdcef1b6a1d3cab

Requested commit: c9fa8e46df21cdf66b291fb3dfdcef1b6a1d3cab

Commit: c9fa8e46df21cdf66b291fb3dfdcef1b6a1d3cab

Tree: be1ef792bffa9d7f6eb6fa186d9100d31181a8db

Author: Carl Åstholm

Committer: Andrew Kelley

## Message

```
Use `mmap` `std.heap.page_allocator` impl when compiling for Wasm + libc

When linking libc, it should be the libc that manages the heap. The main
Wasm memory might have been configured as non-growable, which makes
`WasmAllocator` a poor default and causes the common `DebugAllocator`
use case fail with OOM errors unless the user uses `std_options` to
override the default page allocator. Additionally, on Emscripten,
growing Wasm memory without notifying the JS glue code will cause array
buffers to get detached and lead to spurious crashes.

```

## Parents

- [1bf29757d963b301c1fcfccb9b39b277381de115](https://git.cafe/gitcafe/zig/commit/1bf29757d963b301c1fcfccb9b39b277381de115?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/c9fa8e46df21cdf66b291fb3dfdcef1b6a1d3cab?format=markdown)
