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.
This commit is contained in:
YAMAMOTO Takashi 2024-05-18 02:53:56 +09:00 committed by GitHub
parent 2f088a99d8
commit a3ef1520ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5250,6 +5250,8 @@ static void try_init_allocator(void) {
gm->least_addr = base; gm->least_addr = base;
gm->seg.base = base; gm->seg.base = base;
gm->seg.size = initial_heap_size; gm->seg.size = initial_heap_size;
gm->footprint = initial_heap_size;
gm->max_footprint = initial_heap_size;
gm->magic = mparams.magic; gm->magic = mparams.magic;
gm->release_checks = MAX_RELEASE_CHECK_RATE; gm->release_checks = MAX_RELEASE_CHECK_RATE;
init_bins(gm); init_bins(gm);