MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / do_check_malloc_state

Function do_check_malloc_state

dlmalloc/dlmalloc.c:2837–2863  ·  view source on GitHub ↗

Check all properties of malloc_state. */

Source from the content-addressed store, hash-verified

2835
2836/* Check all properties of malloc_state. */
2837static void do_check_malloc_state(mstate m) {
2838 bindex_t i;
2839 size_t total;
2840 /* check bins */
2841 for (i = 0; i < NSMALLBINS; ++i)
2842 do_check_smallbin(m, i);
2843 for (i = 0; i < NTREEBINS; ++i)
2844 do_check_treebin(m, i);
2845
2846 if (m->dvsize != 0) { /* check dv chunk */
2847 do_check_any_chunk(m, m->dv);
2848 assert(m->dvsize == chunksize(m->dv));
2849 assert(m->dvsize >= MIN_CHUNK_SIZE);
2850 assert(bin_find(m, m->dv) == 0);
2851 }
2852
2853 if (m->top != 0) { /* check top chunk */
2854 do_check_top_chunk(m, m->top);
2855 assert(m->topsize == chunksize(m->top));
2856 assert(m->topsize > 0);
2857 assert(bin_find(m, m->top) == 0);
2858 }
2859
2860 total = traverse_and_check(m);
2861 assert(total <= m->footprint);
2862 assert(m->footprint <= m->max_footprint);
2863}
2864#endif /* DEBUG */
2865
2866/* ----------------------------- statistics ------------------------------ */

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected