Skip to content

Commit 0024b82

Browse files
committed
Use sbrk instead of mmap for dlmalloc on wasm
Fix build
1 parent 1d4dd80 commit 0024b82

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/mono/mono/utils/dlmalloc.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,24 @@
1919
* - the defines below
2020
*/
2121

22+
#include <config.h>
2223
#include "mono-mmap.h"
2324

2425
#define USE_DL_PREFIX 1
2526
#define USE_LOCKS 1
27+
28+
#ifdef HOST_WASM
29+
#pragma clang diagnostic ignored "-Wunused-variable"
30+
/* Use sbrk to allocate memory, and never release pages since emscripten mmap is fake */
31+
#define HAVE_MORECORE 1
32+
#define NO_MALLINFO 1
33+
#undef HAVE_MMAP
34+
#define HAVE_MMAP 0
35+
#else
2636
/* Use mmap for allocating memory */
2737
#define HAVE_MORECORE 0
2838
#define NO_MALLINFO 1
39+
#endif // HOST_WASM
2940
#include <mono/utils/dlmalloc.h>
3041

3142
/*

0 commit comments

Comments
 (0)