/Zephyr-Core-3.7.0/kernel/ |
D | kheap.c | 15 void k_heap_init(struct k_heap *heap, void *mem, size_t bytes) in k_heap_init() argument 17 z_waitq_init(&heap->wait_q); in k_heap_init() 18 sys_heap_init(&heap->heap, mem, bytes); in k_heap_init() 20 SYS_PORT_TRACING_OBJ_INIT(k_heap, heap); in k_heap_init() 25 STRUCT_SECTION_FOREACH(k_heap, heap) { in statics_init() 40 if (lnkr_is_pinned((uint8_t *)heap) && in statics_init() 41 lnkr_is_pinned((uint8_t *)&heap->wait_q) && in statics_init() 42 lnkr_is_region_pinned((uint8_t *)heap->heap.init_mem, in statics_init() 43 heap->heap.init_bytes)) { in statics_init() 50 k_heap_init(heap, heap->heap.init_mem, heap->heap.init_bytes); in statics_init() [all …]
|
D | mempool.c | 12 static void *z_heap_aligned_alloc(struct k_heap *heap, size_t align, size_t size) in z_heap_aligned_alloc() argument 29 mem = k_heap_aligned_alloc(heap, __align, size, K_NO_WAIT); in z_heap_aligned_alloc() 35 *heap_ref = heap; in z_heap_aligned_alloc() 119 struct k_heap *heap, **heap_ref; in k_realloc() local 131 heap = *heap_ref; in k_realloc() 133 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_heap_sys, k_realloc, heap, ptr); in k_realloc() 136 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_heap_sys, k_realloc, heap, ptr, NULL); in k_realloc() 140 ret = k_heap_realloc(heap, ptr, size, K_NO_WAIT); in k_realloc() 147 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_heap_sys, k_realloc, heap, ptr, ret); in k_realloc() 163 struct k_heap *heap; in z_thread_aligned_alloc() local [all …]
|
/Zephyr-Core-3.7.0/lib/heap/ |
D | heap_stats.c | 11 int sys_heap_runtime_stats_get(struct sys_heap *heap, in sys_heap_runtime_stats_get() argument 14 if ((heap == NULL) || (stats == NULL)) { in sys_heap_runtime_stats_get() 18 stats->free_bytes = heap->heap->free_bytes; in sys_heap_runtime_stats_get() 19 stats->allocated_bytes = heap->heap->allocated_bytes; in sys_heap_runtime_stats_get() 20 stats->max_allocated_bytes = heap->heap->max_allocated_bytes; in sys_heap_runtime_stats_get() 25 int sys_heap_runtime_stats_reset_max(struct sys_heap *heap) in sys_heap_runtime_stats_reset_max() argument 27 if (heap == NULL) { in sys_heap_runtime_stats_reset_max() 31 heap->heap->max_allocated_bytes = heap->heap->allocated_bytes; in sys_heap_runtime_stats_reset_max()
|
D | multi_heap.c | 9 void sys_multi_heap_init(struct sys_multi_heap *heap, sys_multi_heap_fn_t choice_fn) in sys_multi_heap_init() argument 11 heap->nheaps = 0; in sys_multi_heap_init() 12 heap->choice = choice_fn; in sys_multi_heap_init() 16 struct sys_heap *heap, void *user_data) in sys_multi_heap_add_heap() argument 20 mheap->heaps[mheap->nheaps].heap = heap; in sys_multi_heap_add_heap() 30 uintptr_t haddr = (uintptr_t)mheap->heaps[j].heap->heap; in sys_multi_heap_add_heap() 69 haddr = (uintptr_t)mheap->heaps[i].heap->heap; in sys_multi_heap_get_heap() 85 const struct sys_multi_heap_rec *heap; in sys_multi_heap_free() local 87 heap = sys_multi_heap_get_heap(mheap, block); in sys_multi_heap_free() 89 if (heap != NULL) { in sys_multi_heap_free() [all …]
|
D | Kconfig | 8 bool "Internal heap validity checking" 13 modifying the heap code or (maybe) when running in 20 bool "General purpose heap stress test" 22 Stresses the heap. 29 Enables support for printing heap internal structure 35 int "Number of tries in the inner heap allocation loop" 41 Setting this to a high level will cause the heap to return 47 keeps the maximum runtime at a tight bound so that the heap 51 bool "System heap runtime statistics" 53 Gather system heap runtime statistics. [all …]
|
D | heap.c | 163 void sys_heap_free(struct sys_heap *heap, void *mem) in sys_heap_free() argument 168 struct z_heap *h = heap->heap; in sys_heap_free() 193 heap_listener_notify_free(HEAP_ID_FROM_POINTER(heap), mem, in sys_heap_free() 200 size_t sys_heap_usable_size(struct sys_heap *heap, void *mem) in sys_heap_usable_size() argument 202 struct z_heap *h = heap->heap; in sys_heap_usable_size() 263 void *sys_heap_alloc(struct sys_heap *heap, size_t bytes) in sys_heap_alloc() argument 265 struct z_heap *h = heap->heap; in sys_heap_alloc() 293 heap_listener_notify_alloc(HEAP_ID_FROM_POINTER(heap), mem, in sys_heap_alloc() 301 void *sys_heap_aligned_alloc(struct sys_heap *heap, size_t align, size_t bytes) in sys_heap_aligned_alloc() argument 303 struct z_heap *h = heap->heap; in sys_heap_aligned_alloc() [all …]
|
D | heap_info.c | 73 void sys_heap_print_info(struct sys_heap *heap, bool dump_chunks) in sys_heap_print_info() argument 75 heap_print_info(heap->heap, dump_chunks); in sys_heap_print_info()
|
D | heap_validate.c | 71 bool sys_heap_validate(struct sys_heap *heap) in sys_heap_validate() argument 73 struct z_heap *h = heap->heap; in sys_heap_validate() 99 sys_heap_runtime_stats_get(heap, &stat); in sys_heap_validate()
|
/Zephyr-Core-3.7.0/include/zephyr/sys/ |
D | sys_heap.h | 57 struct z_heap *heap; member 84 int sys_heap_runtime_stats_get(struct sys_heap *heap, 96 int sys_heap_runtime_stats_reset_max(struct sys_heap *heap); 108 void sys_heap_init(struct sys_heap *heap, void *mem, size_t bytes); 127 void *sys_heap_alloc(struct sys_heap *heap, size_t bytes); 142 void *sys_heap_aligned_alloc(struct sys_heap *heap, size_t align, size_t bytes); 157 void sys_heap_free(struct sys_heap *heap, void *mem); 177 void *sys_heap_aligned_realloc(struct sys_heap *heap, void *ptr, 180 #define sys_heap_realloc(heap, ptr, bytes) \ argument 181 sys_heap_aligned_realloc(heap, ptr, 0, bytes) [all …]
|
D | multi_heap.h | 62 struct sys_heap *heap; member 93 void sys_multi_heap_init(struct sys_multi_heap *heap, 108 void sys_multi_heap_add_heap(struct sys_multi_heap *mheap, struct sys_heap *heap, void *user_data);
|
/Zephyr-Core-3.7.0/tests/lib/heap/src/ |
D | main.c | 170 struct sys_heap heap; in ZTEST() local 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 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() 221 struct sys_heap heap; in ZTEST() local 231 sys_heap_init(&heap, heapmem, BIG_HEAP_SZ); in ZTEST() [all …]
|
/Zephyr-Core-3.7.0/tests/lib/heap_align/src/ |
D | main.c | 62 struct sys_heap heap = {}; in ZTEST() local 65 sys_heap_init(&heap, heapmem, HEAP_SZ); in ZTEST() 67 p = sys_heap_alloc(&heap, 1); in ZTEST() 69 sys_heap_free(&heap, p); in ZTEST() 80 check_heap_align(&heap, prefix, align, size); in ZTEST() 86 p = sys_heap_aligned_alloc(&heap, 8, 12); in ZTEST() 88 zassert_true(sys_heap_validate(&heap), "heap invalid"); in ZTEST() 89 sys_heap_free(&heap, p); in ZTEST() 92 p = sys_heap_aligned_alloc(&heap, 16, 16); in ZTEST() 93 q = sys_heap_aligned_alloc(&heap, 16, 17); in ZTEST() [all …]
|
/Zephyr-Core-3.7.0/samples/basic/sys_heap/src/ |
D | main.c | 13 static struct sys_heap heap; variable 23 sys_heap_init(&heap, heap_mem, HEAP_SIZE); in main() 26 p = sys_heap_alloc(&heap, 150); in main() 29 p = sys_heap_realloc(&heap, p, 100); in main() 32 sys_heap_free(&heap, p); in main() 41 sys_heap_runtime_stats_get(&heap, &stats); in print_sys_memory_stats()
|
/Zephyr-Core-3.7.0/samples/basic/sys_heap/ |
D | README.rst | 1 .. zephyr:code-sample:: sys-heap 2 :name: System heap 4 Print system heap usage to the console. 10 prints system heap usage to the console. 36 System heap sample 38 allocated 0, free 196, max allocated 0, heap size 256 39 allocated 156, free 36, max allocated 156, heap size 256 40 allocated 100, free 92, max allocated 156, heap size 256 41 allocated 0, free 196, max allocated 156, heap size 256
|
/Zephyr-Core-3.7.0/lib/libc/newlib/ |
D | Kconfig | 15 int "Maximum memory mapped for newlib heap" 20 will be used for the newlib malloc() heap. The actual amount of 25 int "Newlib minimum required heap size" 30 newlib heap. An assertion failure message will be displayed during 31 initialization if the memory space available for the newlib heap is 35 int "Newlib aligned heap size" 42 and user mode threads need to access this heap, then this is necessary 43 to properly define an MPU region for the heap. 61 bool "Notify heap listeners of newlib libc heap events" 64 Notify registered heap listeners upon certain events related to the newlib [all …]
|
/Zephyr-Core-3.7.0/doc/kernel/memory_management/ |
D | heap.rst | 15 The simplest way to define a heap is statically, with the 26 Memory can be allocated from a heap using :c:func:`k_heap_alloc`, 27 passing it the address of the heap object and the number of bytes 31 The heap supports blocking operation, allowing threads to go to sleep 43 returned by :c:func:`k_heap_alloc` for the same heap. Freeing a 56 functions on a single heap must be serialized by the caller. 71 The heap code takes reasonable care to avoid fragmentation. Free 76 allocations are freed and added to the heap, they are automatically 80 heap memory, including the variable-length list of bucket list heads 81 (which depend on heap size). The only external memory required is the [all …]
|
D | shared_multi_heap.rst | 6 The shared multi-heap memory pool manager uses the multi-heap allocator to 10 All the different regions can be added at run-time to the shared multi-heap 16 1. At boot time some platform code initialize the shared multi-heap framework 28 // Init the shared multi-heap pool 63 care of selecting the correct heap (thus memory region) to carve memory 65 (available memory, heap state, etc...)
|
/Zephyr-Core-3.7.0/doc/develop/languages/c/ |
D | common_libc.rst | 25 The common C library internally uses the :ref:`kernel memory heap API 26 <heap_v2>` to manage the memory heap used by the standard dynamic memory 29 The internal memory heap is normally located in the ``.bss`` section. When 32 threads. The size of the internal memory heap is specified by the 35 The default heap size for applications using the common C library is zero 36 (no heap). For other C library users, if there is an MMU present, then the 37 default heap is 16kB. Otherwise, the heap uses all available memory.
|
D | newlib.rst | 80 Newlib implements an internal heap allocator to manage the memory blocks used 84 The internal heap allocator implemented by the Newlib may vary across the 85 different types of the Newlib used. For example, the heap allocator implemented 93 Newlib to manage the size of the memory pool reserved for its internal heap 98 Newlib internal heap allocator memory pool size does not exceed the amount of 101 When userspace is enabled, the Newlib internal heap allocator memory pool is 105 The amount of memory space available for the Newlib heap depends on the system 109 memory space reserved for the Newlib heap is set by the size of the free 117 heap is set by the :kconfig:option:`CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE`. 119 * Otherwise, the amount of memory space reserved for the Newlib heap is equal
|
/Zephyr-Core-3.7.0/samples/modules/tflite-micro/tflm_ethosu/src/ |
D | main.cpp | 107 k_heap *heap = static_cast<k_heap *>(k_malloc(sizeof(k_heap))); in allocateHeap() local 110 if ((buf == nullptr) || (heap == nullptr)) { in allocateHeap() 111 printk("Heap allocation failed. heap=%p, buf=%p, size=%zu\n", heap, buf, size); in allocateHeap() 115 k_heap_init(heap, buf, size); in allocateHeap() 117 return static_cast<void *>(heap); in allocateHeap() 121 void inferenceProcessTask(void *_name, void *heap, void *_params) in inferenceProcessTask() argument 127 k_thread_heap_assign(k_current_get(), static_cast<k_heap *>(heap)); in inferenceProcessTask() 158 void inferenceSenderTask(void *_name, void *heap, void *_queue) in inferenceSenderTask() argument 165 k_thread_heap_assign(k_current_get(), static_cast<k_heap *>(heap)); in inferenceSenderTask()
|
/Zephyr-Core-3.7.0/subsys/tracing/user/ |
D | tracing_user.h | 57 #define sys_port_trace_k_thread_heap_assign(thread, heap) argument 289 #define sys_port_trace_k_heap_init(heap) argument 290 #define sys_port_trace_k_heap_aligned_alloc_enter(heap, timeout) argument 291 #define sys_port_trace_k_heap_aligned_alloc_blocking(heap, timeout) argument 292 #define sys_port_trace_k_heap_aligned_alloc_exit(heap, timeout, ret) argument 293 #define sys_port_trace_k_heap_alloc_enter(heap, timeout) argument 294 #define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret) argument 295 #define sys_port_trace_k_heap_free(heap) argument 298 #define sys_port_trace_k_heap_sys_k_aligned_alloc_enter(heap) argument 299 #define sys_port_trace_k_heap_sys_k_aligned_alloc_exit(heap, ret) argument [all …]
|
/Zephyr-Core-3.7.0/subsys/tracing/sysview/ |
D | tracing_sysview.h | 40 #define sys_port_trace_k_thread_heap_assign(thread, heap) argument 547 #define sys_port_trace_k_heap_init(heap) \ argument 548 SEGGER_SYSVIEW_RecordU32(TID_HEAP_INIT, (uint32_t)(uintptr_t)heap) 550 #define sys_port_trace_k_heap_aligned_alloc_enter(heap, timeout) \ argument 551 SEGGER_SYSVIEW_RecordU32x2(TID_HEAP_ALIGNED_ALLOC, (uint32_t)(uintptr_t)heap, \ 554 #define sys_port_trace_k_heap_aligned_alloc_blocking(heap, timeout) argument 556 #define sys_port_trace_k_heap_aligned_alloc_exit(heap, timeout, ret) \ argument 559 #define sys_port_trace_k_heap_alloc_enter(heap, timeout) \ argument 560 SEGGER_SYSVIEW_RecordU32x2(TID_HEAP_ALLOC, (uint32_t)(uintptr_t)heap, \ 563 #define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret) \ argument [all …]
|
/Zephyr-Core-3.7.0/subsys/mgmt/mcumgr/grp/settings_mgmt/ |
D | Kconfig | 20 Selects if the stack or heap will be used for variables that are 37 Use dynamic heap memory allocation through malloc, if there is 38 insufficient heap memory for the allocation then the request will be 49 variable if placed on the heap. 57 variable if placed on the heap (settings does not support getting
|
/Zephyr-Core-3.7.0/subsys/tracing/ctf/ |
D | tracing_ctf.h | 30 #define sys_port_trace_k_thread_heap_assign(thread, heap) argument 299 #define sys_port_trace_k_heap_init(heap) argument 300 #define sys_port_trace_k_heap_aligned_alloc_enter(heap, timeout) argument 301 #define sys_port_trace_k_heap_aligned_alloc_blocking(heap, timeout) argument 302 #define sys_port_trace_k_heap_aligned_alloc_exit(heap, timeout, ret) argument 303 #define sys_port_trace_k_heap_alloc_enter(heap, timeout) argument 304 #define sys_port_trace_k_heap_alloc_exit(heap, timeout, ret) argument 305 #define sys_port_trace_k_heap_free(heap) argument 308 #define sys_port_trace_k_heap_sys_k_aligned_alloc_enter(heap) argument 309 #define sys_port_trace_k_heap_sys_k_aligned_alloc_exit(heap, ret) argument [all …]
|
/Zephyr-Core-3.7.0/subsys/mem_mgmt/ |
D | mem_attr_heap.c | 16 struct sys_heap heap; member 49 block = sys_heap_aligned_alloc(&h->heap, align, size); in mah_choice() 95 h = &mh->heap; in ma_heap_add()
|