Skip to content

Commit a3ef152

Browse files
authored
dlmalloc: account the footprint of the initial heap (#496)
While malloc_stats and friends are disabled and unused for wasi-libc, it's neater to be consistent. Background: My colleagues for some reasons enabled malloc_stats and asked me why it reports negative values. Note: Depending __heap_base, init_top() adjusts the address for alignment. I think the amount of this adjustment is reported as "used" by malloc_stats. I don't bother to "fix" it.
1 parent 2f088a9 commit a3ef152

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

dlmalloc/src/malloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5250,6 +5250,8 @@ static void try_init_allocator(void) {
52505250
gm->least_addr = base;
52515251
gm->seg.base = base;
52525252
gm->seg.size = initial_heap_size;
5253+
gm->footprint = initial_heap_size;
5254+
gm->max_footprint = initial_heap_size;
52535255
gm->magic = mparams.magic;
52545256
gm->release_checks = MAX_RELEASE_CHECK_RATE;
52555257
init_bins(gm);

0 commit comments

Comments
 (0)