diff options
author | Cheng Shao <terrorjack@type.dance> | 2023-02-11 17:24:02 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-02-15 00:17:53 -0500 |
commit | 9ca51f9e84abc41ba590203d8bc8df8d6af86db2 (patch) | |
tree | 15920fff710ab7b5651f5728ea65dbcacd363016 /rts/sm/BlockAlloc.c | |
parent | 79d8fd6581af62e72727337001029533bf55e64f (diff) | |
download | haskell-9ca51f9e84abc41ba590203d8bc8df8d6af86db2.tar.gz |
rts: add the rts_clearMemory function
This patch adds the rts_clearMemory function that does its best to
zero out unused RTS memory for a wasm backend use case. See the
comment above rts_clearMemory() prototype declaration for more
detailed explanation. Closes #22920.
Diffstat (limited to 'rts/sm/BlockAlloc.c')
-rw-r--r-- | rts/sm/BlockAlloc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index 257dc253ed..158698b08f 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -1395,3 +1395,17 @@ reportUnmarkedBlocks (void) } #endif + +void clear_free_list(void) { + for (uint32_t node = 0; node < n_numa_nodes; ++node) { + for (bdescr *bd = free_mblock_list[node]; bd != NULL; bd = bd->link) { + clear_blocks(bd); + } + + for (int ln = 0; ln < NUM_FREE_LISTS; ++ln) { + for (bdescr *bd = free_list[node][ln]; bd != NULL; bd = bd->link) { + clear_blocks(bd); + } + } + } +} |