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

Function do_check_free_chunk

system/lib/dlmalloc.c:3345–3365  ·  view source on GitHub ↗

Check properties of free chunks */

Source from the content-addressed store, hash-verified

3343
3344/* Check properties of free chunks */
3345static void do_check_free_chunk(mstate m, mchunkptr p) {
3346 size_t sz = chunksize(p);
3347 mchunkptr next = chunk_plus_offset(p, sz);
3348 do_check_any_chunk(m, p);
3349 assert(!is_inuse(p));
3350 assert(!next_pinuse(p));
3351 assert (!is_mmapped(p));
3352 if (p != m->dv && p != m->top) {
3353 if (sz >= MIN_CHUNK_SIZE) {
3354 assert((sz & CHUNK_ALIGN_MASK) == 0);
3355 assert(is_aligned(chunk2mem(p)));
3356 assert(next->prev_foot == sz);
3357 assert(pinuse(p));
3358 assert (next == m->top || is_inuse(next));
3359 assert(p->fd->bk == p);
3360 assert(p->bk->fd == p);
3361 }
3362 else /* markers are always of size SIZE_T_SIZE */
3363 assert(sz == SIZE_T_SIZE);
3364 }
3365}
3366
3367/* Check properties of malloced chunks at the point they are malloced */
3368static void do_check_malloced_chunk(mstate m, void* mem, size_t s) {

Callers 2

do_check_smallbinFunction · 0.85
traverse_and_checkFunction · 0.85

Calls 2

do_check_any_chunkFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected