Lines Matching +full:free +full:- +full:running

4  * SPDX-License-Identifier: Apache-2.0
11 /* White-box sys_heap validation code. Uses internal data structures.
15 * that it is the CORRECT heap given the history of alloc/free calls
17 * something scribbling a copy of a previously-valid heap on top of a
18 * running one and corrupting it. YMMV.
26 VALIDATE(c < h->end_chunk); in in_bounds()
27 VALIDATE(chunk_size(h, c) < h->end_chunk); in in_bounds()
34 VALIDATE((c + chunk_size(h, c)) <= h->end_chunk); in valid_chunk()
57 struct z_heap_bucket *b = &h->buckets[bidx]; in check_nexts()
59 bool emptybit = (h->avail_buckets & BIT(bidx)) == 0; in check_nexts()
60 bool emptylist = b->next == 0; in check_nexts()
66 if (b->next != 0) { in check_nexts()
67 CHECK(valid_chunk(h, b->next)); in check_nexts()
73 struct z_heap *h = heap->heap; in sys_heap_validate()
79 for (c = right_chunk(h, 0); c < h->end_chunk; c = right_chunk(h, c)) { in sys_heap_validate()
84 if (c != h->end_chunk) { in sys_heap_validate()
92 * free bytes, then compare with the results of in sys_heap_validate()
106 /* Check the free lists: entry count should match, empty bit in sys_heap_validate()
110 for (int b = 0; b <= bucket_idx(h, h->end_chunk); b++) { in sys_heap_validate()
111 chunkid_t c0 = h->buckets[b].next; in sys_heap_validate()
124 bool empty = (h->avail_buckets & BIT(b)) == 0; in sys_heap_validate()
131 if (empty && (h->buckets[b].next != 0)) { in sys_heap_validate()
138 * but solo headers are now USED (i.e. all free blocks were found in sys_heap_validate()
144 for (c = right_chunk(h, 0); c < h->end_chunk; c = right_chunk(h, c)) { in sys_heap_validate()
155 if (c != h->end_chunk) { in sys_heap_validate()
159 /* Go through the free lists again checking that the linear in sys_heap_validate()
163 for (int b = 0; b <= bucket_idx(h, h->end_chunk); b++) { in sys_heap_validate()
164 chunkid_t c0 = h->buckets[b].next; in sys_heap_validate()
179 /* Now we are valid, but have managed to invert all the in-use in sys_heap_validate()
182 for (c = right_chunk(h, 0); c < h->end_chunk; c = right_chunk(h, c)) { in sys_heap_validate()