| 3607 | |
| 3608 | #if !NO_MALLOC_STATS |
| 3609 | static void internal_malloc_stats(mstate m) { |
| 3610 | ensure_initialization(); |
| 3611 | if (!PREACTION(m)) { |
| 3612 | size_t maxfp = 0; |
| 3613 | size_t fp = 0; |
| 3614 | size_t used = 0; |
| 3615 | check_malloc_state(m); |
| 3616 | if (is_initialized(m)) { |
| 3617 | msegmentptr s = &m->seg; |
| 3618 | maxfp = m->max_footprint; |
| 3619 | fp = m->footprint; |
| 3620 | used = fp - (m->topsize + TOP_FOOT_SIZE); |
| 3621 | |
| 3622 | while (s != 0) { |
| 3623 | mchunkptr q = align_as_chunk(s->base); |
| 3624 | while (segment_holds(s, q) && |
| 3625 | q != m->top && q->head != FENCEPOST_HEAD) { |
| 3626 | if (!is_inuse(q)) |
| 3627 | used -= chunksize(q); |
| 3628 | q = next_chunk(q); |
| 3629 | } |
| 3630 | s = s->next; |
| 3631 | } |
| 3632 | } |
| 3633 | POSTACTION(m); /* drop lock */ |
| 3634 | fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); |
| 3635 | fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); |
| 3636 | fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); |
| 3637 | } |
| 3638 | } |
| 3639 | #endif /* NO_MALLOC_STATS */ |
| 3640 | |
| 3641 | /* ----------------------- Operations on smallbins ----------------------- */ |
no test coverage detected