MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / do_check_malloc_state

Function do_check_malloc_state

system/lib/dlmalloc.c:3536–3562  ·  view source on GitHub ↗

Check all properties of malloc_state. */

Source from the content-addressed store, hash-verified

3534
3535/* Check all properties of malloc_state. */
3536static void do_check_malloc_state(mstate m) {
3537 bindex_t i;
3538 size_t total;
3539 /* check bins */
3540 for (i = 0; i < NSMALLBINS; ++i)
3541 do_check_smallbin(m, i);
3542 for (i = 0; i < NTREEBINS; ++i)
3543 do_check_treebin(m, i);
3544
3545 if (m->dvsize != 0) { /* check dv chunk */
3546 do_check_any_chunk(m, m->dv);
3547 assert(m->dvsize == chunksize(m->dv));
3548 assert(m->dvsize >= MIN_CHUNK_SIZE);
3549 assert(bin_find(m, m->dv) == 0);
3550 }
3551
3552 if (m->top != 0) { /* check top chunk */
3553 do_check_top_chunk(m, m->top);
3554 /*assert(m->topsize == chunksize(m->top)); redundant */
3555 assert(m->topsize > 0);
3556 assert(bin_find(m, m->top) == 0);
3557 }
3558
3559 total = traverse_and_check(m);
3560 assert(total <= m->footprint);
3561 assert(m->footprint <= m->max_footprint);
3562}
3563#endif /* DEBUG */
3564
3565/* ----------------------------- statistics ------------------------------ */

Callers

nothing calls this directly

Calls 7

do_check_smallbinFunction · 0.85
do_check_treebinFunction · 0.85
do_check_any_chunkFunction · 0.85
bin_findFunction · 0.85
do_check_top_chunkFunction · 0.85
traverse_and_checkFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected