Lines Matching full:heap
111 bool heap_caps_match(const heap_t *heap, uint32_t caps) in heap_caps_match() argument
113 return heap->heap != NULL && ((get_all_caps(heap) & caps) == caps); in heap_caps_match()
134 …//NULL directly, even although our heap capabilities (based on soc_memory_tags & soc_memory_region… in heap_caps_malloc_base()
151 heap_t *heap; in heap_caps_malloc_base() local
152 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_malloc_base()
153 if (heap->heap == NULL) { in heap_caps_malloc_base()
156 if ((heap->caps[prio] & caps) != 0) { in heap_caps_malloc_base()
157 … //Heap has at least one of the caps requested. If caps has other bits set that this prio in heap_caps_malloc_base()
159 if ((get_all_caps(heap) & caps) == caps) { in heap_caps_malloc_base()
160 … //This heap can satisfy all the requested capabilities. See if we can grab some memory using it. in heap_caps_malloc_base()
163 …(caps & MALLOC_CAP_EXEC) && !esp_dram_match_iram() && esp_ptr_in_diram_dram((void *)heap->start)) { in heap_caps_malloc_base()
167 … ret = multi_heap_malloc(heap->heap, size + 4); // int overflow checked above in heap_caps_malloc_base()
176 ret = multi_heap_malloc(heap->heap, size); in heap_caps_malloc_base()
354 /* Find the heap which belongs to ptr, or return NULL if it's
355 not in any heap.
357 (This confirms if ptr is inside the heap's region, doesn't confirm if 'ptr'
358 is an allocated block or is some other random address inside the heap.)
363 heap_t *heap; in find_containing_heap() local
364 SLIST_FOREACH(heap, ®istered_heaps, next) { in find_containing_heap()
365 if (heap->heap != NULL && p >= heap->start && p < heap->end) { in find_containing_heap()
366 return heap; in find_containing_heap()
386 heap_t *heap = find_containing_heap(ptr); in heap_caps_free() local
387 assert(heap != NULL && "free() target pointer is outside heap areas"); in heap_caps_free()
388 multi_heap_free(heap->heap, ptr); in heap_caps_free()
400 heap_t *heap = NULL; in heap_caps_realloc_base() local
422 heap = find_containing_heap(dram_ptr); in heap_caps_realloc_base()
423 assert(heap != NULL && "realloc() pointer is outside heap areas"); in heap_caps_realloc_base()
431 heap = find_containing_heap(ptr); in heap_caps_realloc_base()
432 assert(heap != NULL && "realloc() pointer is outside heap areas"); in heap_caps_realloc_base()
435 // are the existing heap's capabilities compatible with the in heap_caps_realloc_base()
437 bool compatible_caps = (caps & get_all_caps(heap)) == caps; in heap_caps_realloc_base()
440 // try to reallocate this memory within the same heap in heap_caps_realloc_base()
442 void *r = multi_heap_realloc(heap->heap, ptr, size); in heap_caps_realloc_base()
450 // in a different heap with requested capabilities. in heap_caps_realloc_base()
456 //heap can only be obtained with translated address. in heap_caps_realloc_base()
458 old_size = multi_heap_get_allocated_size(heap->heap, dram_ptr); in heap_caps_realloc_base()
460 old_size = multi_heap_get_allocated_size(heap->heap, ptr); in heap_caps_realloc_base()
519 heap_t *heap; in heap_caps_get_total_size() local
520 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_get_total_size()
521 if (heap_caps_match(heap, caps)) { in heap_caps_get_total_size()
522 total_size += (heap->end - heap->start); in heap_caps_get_total_size()
531 heap_t *heap; in heap_caps_get_free_size() local
532 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_get_free_size()
533 if (heap_caps_match(heap, caps)) { in heap_caps_get_free_size()
534 ret += multi_heap_free_size(heap->heap); in heap_caps_get_free_size()
543 heap_t *heap; in heap_caps_get_minimum_free_size() local
544 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_get_minimum_free_size()
545 if (heap_caps_match(heap, caps)) { in heap_caps_get_minimum_free_size()
546 ret += multi_heap_minimum_free_size(heap->heap); in heap_caps_get_minimum_free_size()
563 heap_t *heap; in heap_caps_get_info() local
564 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_get_info()
565 if (heap_caps_match(heap, caps)) { in heap_caps_get_info()
567 multi_heap_get_info(heap->heap, &hinfo); in heap_caps_get_info()
584 printf("Heap summary for capabilities 0x%08"PRIX32":\n", caps); in heap_caps_print_heap_info()
585 heap_t *heap; in heap_caps_print_heap_info() local
586 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_print_heap_info()
587 if (heap_caps_match(heap, caps)) { in heap_caps_print_heap_info()
588 multi_heap_get_info(heap->heap, &info); in heap_caps_print_heap_info()
591 …heap->start, heap->end - heap->start, info.total_free_bytes, info.total_allocated_bytes, info.mini… in heap_caps_print_heap_info()
608 heap_t *heap; in heap_caps_check_integrity() local
609 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_check_integrity()
610 if (heap->heap != NULL in heap_caps_check_integrity()
611 && (all_heaps || (get_all_caps(heap) & caps) == caps)) { in heap_caps_check_integrity()
612 valid = multi_heap_check(heap->heap, print_errors) && valid; in heap_caps_check_integrity()
626 heap_t *heap = find_containing_heap((void *)addr); in heap_caps_check_integrity_addr() local
627 if (heap == NULL) { in heap_caps_check_integrity_addr()
630 return multi_heap_check(heap->heap, print_errors); in heap_caps_check_integrity_addr()
636 heap_t *heap; in heap_caps_dump() local
637 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_dump()
638 if (heap->heap != NULL in heap_caps_dump()
639 && (all_heaps || (get_all_caps(heap) & caps) == caps)) { in heap_caps_dump()
640 multi_heap_dump(heap->heap); in heap_caps_dump()
652 heap_t *heap = find_containing_heap(ptr); in heap_caps_get_allocated_size() local
653 assert(heap); in heap_caps_get_allocated_size()
654 size_t size = multi_heap_get_allocated_size(heap->heap, ptr); in heap_caps_get_allocated_size()
685 heap_t *heap; in heap_caps_aligned_alloc() local
686 SLIST_FOREACH(heap, ®istered_heaps, next) { in heap_caps_aligned_alloc()
687 if (heap->heap == NULL) { in heap_caps_aligned_alloc()
690 if ((heap->caps[prio] & caps) != 0) { in heap_caps_aligned_alloc()
691 … //Heap has at least one of the caps requested. If caps has other bits set that this prio in heap_caps_aligned_alloc()
693 if ((get_all_caps(heap) & caps) == caps) { in heap_caps_aligned_alloc()
695 ret = multi_heap_aligned_alloc(heap->heap, size, alignment); in heap_caps_aligned_alloc()