MCPcopy Index your code
hub / github.com/dcodeIO/webassembly / do_check_smallbin

Function do_check_smallbin

lib/dlmalloc/malloc.c:3358–3379  ·  view source on GitHub ↗

Check all the chunks in a smallbin. */

Source from the content-addressed store, hash-verified

3356
3357/* Check all the chunks in a smallbin. */
3358static void do_check_smallbin(mstate m, bindex_t i) {
3359 sbinptr b = smallbin_at(m, i);
3360 mchunkptr p = b->bk;
3361 unsigned int empty = (m->smallmap & (1U << i)) == 0;
3362 if (p == b)
3363 assert(empty);
3364 if (!empty) {
3365 for (; p != b; p = p->bk) {
3366 size_t size = chunksize(p);
3367 mchunkptr q;
3368 /* each chunk claims to be free */
3369 do_check_free_chunk(m, p);
3370 /* chunk belongs in bin */
3371 assert(small_index(size) == i);
3372 assert(p->bk == b || chunksize(p->bk) == chunksize(p));
3373 /* chunk is followed by an inuse chunk */
3374 q = next_chunk(p);
3375 if (q->head != FENCEPOST_HEAD)
3376 do_check_inuse_chunk(m, q);
3377 }
3378 }
3379}
3380
3381/* Find x in a bin. Used in other check functions. */
3382static int bin_find(mstate m, mchunkptr x) {

Callers 1

do_check_malloc_stateFunction · 0.85

Calls 2

do_check_free_chunkFunction · 0.85
do_check_inuse_chunkFunction · 0.85

Tested by

no test coverage detected