diff options
author | Cheng Shao <astrohavoc@gmail.com> | 2022-10-23 16:32:54 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-11-11 00:26:55 -0500 |
commit | 15138746a772fce1052cf117293594019c917a90 (patch) | |
tree | 4c2520baa4ef20755b062075bd21e15170766aff | |
parent | 88bbdb3186f39c878677f03dbb5fd91a03632be7 (diff) | |
download | haskell-15138746a772fce1052cf117293594019c917a90.tar.gz |
rts: don't return memory to OS on wasm32
This patch makes the storage manager not return any memory on wasm32.
The detailed reason is described in Note [Megablock allocator on
wasm].
-rw-r--r-- | rts/sm/BlockAlloc.c | 5 | ||||
-rw-r--r-- | rts/sm/MBlock.c | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index d99d01d743..257dc253ed 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -1184,6 +1184,10 @@ countAllocdBlocks(bdescr *bd) // Returns the number of blocks which were able to be freed uint32_t returnMemoryToOS(uint32_t n /* megablocks */) { +#if defined(wasm32_HOST_ARCH) + // See Note [Megablock allocator on wasm]. + return 0; +#else bdescr *bd; uint32_t node; StgWord size; @@ -1237,6 +1241,7 @@ uint32_t returnMemoryToOS(uint32_t n /* megablocks */) } ); return (init_n - n); +#endif } /* ----------------------------------------------------------------------------- diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c index 84dc6a2bc0..6eb3375304 100644 --- a/rts/sm/MBlock.c +++ b/rts/sm/MBlock.c @@ -617,6 +617,8 @@ freeMBlocks(void *addr, uint32_t n) void freeAllMBlocks(void) { +// See Note [Megablock allocator on wasm]. +#if !defined(wasm32_HOST_ARCH) debugTrace(DEBUG_gc, "freeing all megablocks"); #if defined(USE_LARGE_ADDRESS_SPACE) @@ -647,6 +649,7 @@ freeAllMBlocks(void) #endif #endif +#endif } void |