Lines Matching full:heap

12 /* Guess at a value for heap size based on available memory on the
61 /* How many alloc/free operations are tested on each heap. Two per
62 * byte of heap sounds about right to get exhaustive coverage without
121 /* White box: the heap internals will allocate memory in testalloc()
163 /* Do a heavy test over a small heap, with many iterations that need
170 struct sys_heap heap; in ZTEST() local
173 TC_PRINT("Testing small (%d byte) heap\n", (int) SMALL_HEAP_SZ); in ZTEST()
175 sys_heap_init(&heap, heapmem, SMALL_HEAP_SZ); in ZTEST()
176 zassert_true(sys_heap_validate(&heap), ""); in ZTEST()
177 sys_heap_stress(testalloc, testfree, &heap, in ZTEST()
198 struct sys_heap heap; in ZTEST() local
201 TC_PRINT("Testing maximally fragmented (%d byte) heap\n", in ZTEST()
204 sys_heap_init(&heap, heapmem, SMALL_HEAP_SZ); in ZTEST()
205 zassert_true(sys_heap_validate(&heap), ""); in ZTEST()
206 sys_heap_stress(testalloc, testfree, &heap, in ZTEST()
214 /* The heap block format changes for heaps with more than 2^15 chunks,
221 struct sys_heap heap; in ZTEST() local
225 TC_PRINT("big heap support is disabled\n"); in ZTEST()
229 TC_PRINT("Testing big (%d byte) heap\n", (int) BIG_HEAP_SZ); in ZTEST()
231 sys_heap_init(&heap, heapmem, BIG_HEAP_SZ); in ZTEST()
232 zassert_true(sys_heap_validate(&heap), ""); in ZTEST()
233 sys_heap_stress(testalloc, testfree, &heap, in ZTEST()
241 /* Test a heap with a solo free header. A solo free header can exist
242 * only on a heap with 64 bit CPU (or chunk_header_bytes() == 8).
243 * With 64 bytes heap and 1 byte allocation on a big heap, we get:
258 struct sys_heap heap; in ZTEST() local
260 TC_PRINT("Testing solo free header in a heap\n"); in ZTEST()
262 sys_heap_init(&heap, heapmem, SOLO_FREE_HEADER_HEAP_SZ); in ZTEST()
264 sys_heap_alloc(&heap, 1); in ZTEST()
265 zassert_true(sys_heap_validate(&heap), ""); in ZTEST()
295 struct sys_heap heap; in ZTEST() local
299 * to high in an empty heap. in ZTEST()
302 sys_heap_init(&heap, heapmem, SMALL_HEAP_SZ); in ZTEST()
304 /* Allocate from an empty heap, then expand, validate that it in ZTEST()
307 p1 = sys_heap_alloc(&heap, 64); in ZTEST()
309 p2 = sys_heap_realloc(&heap, p1, 128); in ZTEST()
311 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
320 p1 = sys_heap_alloc(&heap, 64); in ZTEST()
322 p2 = sys_heap_alloc(&heap, 64); in ZTEST()
324 p3 = sys_heap_realloc(&heap, p1, 128); in ZTEST()
326 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
333 p1 = sys_heap_alloc(&heap, 128); in ZTEST()
335 p2 = sys_heap_realloc(&heap, p1, 64); in ZTEST()
337 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
346 p1 = sys_heap_alloc(&heap, 61); in ZTEST()
348 p2 = sys_heap_alloc(&heap, 80); in ZTEST()
350 p3 = sys_heap_realloc(&heap, p1, 64); in ZTEST()
352 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
362 p1 = sys_heap_aligned_alloc(&heap, 8, 32); in ZTEST()
364 p2 = sys_heap_alloc(&heap, 32); in ZTEST()
366 p3 = sys_heap_aligned_realloc(&heap, p1, 8, 36); in ZTEST()
368 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
372 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
377 p1 = sys_heap_aligned_alloc(&heap, 32, 32); in ZTEST()
378 p2 = sys_heap_aligned_alloc(&heap, 8, 32); in ZTEST()
379 p3 = sys_heap_aligned_realloc(&heap, p2, 8, 16); in ZTEST()
380 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
384 p3 = sys_heap_aligned_alloc(&heap, 32, 8); in ZTEST()
385 zassert_true(sys_heap_validate(&heap), "invalid heap"); in ZTEST()
400 TC_PRINT("Heap 0x%" PRIxPTR ", alloc %p, size %u\n", in heap_alloc_cb()
409 TC_PRINT("Heap 0x%" PRIxPTR ", free %p, size %u\n", in heap_free_cb()
444 "Heap ID mismatched: 0x%lx != %p", listener_heap_id, in ZTEST()
447 "Heap allocated pointer mismatched: %p != %p", in ZTEST()
453 "Heap ID mismatched: 0x%lx != %p", listener_heap_id, in ZTEST()
456 "Heap allocated pointer mismatched: %p != %p", in ZTEST()
464 "Heap ID mismatched: 0x%lx != %p", listener_heap_id, in ZTEST()
467 "Heap allocated pointer mismatched: %p != %p", in ZTEST()
473 "Heap ID mismatched: 0x%lx != %p", listener_heap_id, in ZTEST()
476 "Heap allocated pointer mismatched: %p != %p", in ZTEST()