Skip to content

Commit

Permalink
Use sbrk instead of mmap for dlmalloc on wasm
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
kg committed Mar 27, 2024
1 parent 1d4dd80 commit 0024b82
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/mono/mono/utils/dlmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@
* - the defines below
*/

#include <config.h>
#include "mono-mmap.h"

#define USE_DL_PREFIX 1
#define USE_LOCKS 1

#ifdef HOST_WASM
#pragma clang diagnostic ignored "-Wunused-variable"
/* Use sbrk to allocate memory, and never release pages since emscripten mmap is fake */
#define HAVE_MORECORE 1
#define NO_MALLINFO 1
#undef HAVE_MMAP
#define HAVE_MMAP 0
#else
/* Use mmap for allocating memory */
#define HAVE_MORECORE 0
#define NO_MALLINFO 1
#endif // HOST_WASM
#include <mono/utils/dlmalloc.h>

/*
Expand Down

0 comments on commit 0024b82

Please sign in to comment.