Home
last modified time | relevance | path

Searched full:heap (Results 1 – 25 of 287) sorted by relevance

12345678910>>...12

/Zephyr-latest/kernel/
Dkheap.c15 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()
29 * each 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()
[all …]
Dmempool.c12 static void *z_heap_aligned_alloc(struct k_heap *heap, size_t align, size_t size) in z_heap_aligned_alloc() argument
19 * Adjust the size to make room for our heap reference. in z_heap_aligned_alloc()
21 * This allows for storing the heap pointer right below the aligned in z_heap_aligned_alloc()
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()
[all …]
/Zephyr-latest/include/zephyr/sys/
Dheap_listener.h21 * @defgroup heap_listener_apis Heap Listener APIs
43 * @brief Callback used when heap is resized
47 * @param heap_id Identifier of heap being resized
48 * @param old_heap_end Pointer to end of heap before resize
49 * @param new_heap_end Pointer to end of heap after resize
57 * @brief Callback used when there is heap allocation
64 * mechanism of the heap may allocate more than
67 * @param heap_id Heap identifier
76 * @brief Callback used when memory is freed from heap
83 * mechanism of the heap dictates how memory is
[all …]
Dmulti_heap.h13 * @defgroup multi_heap_wrapper Multi-Heap Wrapper
19 * @brief Multi-heap allocator
30 * function whose job it is to select a heap based on information in
31 * the config specifier and runtime state (heap full state, etc...)
36 * @brief Multi-heap choice function
42 * free to choose any registered heap backend to perform the
50 * @param mheap Multi-heap structure.
62 struct sys_heap *heap; member
73 * @brief Initialize multi-heap
77 * sys_multi_heap_add_heap so that the heap bounds can be tracked by
[all …]
Dsys_heap.h19 /* Simple, fast heap implementation.
39 * the chunk is always returned immediately to the heap for other
51 * have somewhere to put the arguments. The actual heap metadata at
52 * runtime lives in the heap memory itself and this struct simply
58 struct z_heap *heap; member
71 * @defgroup low_level_heap_allocator Low Level Heap Allocator
81 * @param heap Pointer to specified sys_heap
85 int sys_heap_runtime_stats_get(struct sys_heap *heap,
89 * @brief Reset the maximum heap usage.
94 * @param heap Pointer to sys_heap
[all …]
/Zephyr-latest/lib/heap/
Dheap_stats.c9 #include "heap.h"
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()
DKconfig5 menu "Heap and Memory Allocation"
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.
27 bool "Heap internal structure information"
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
[all …]
Dmulti_heap.c10 void sys_multi_heap_init(struct sys_multi_heap *heap, sys_multi_heap_fn_t choice_fn) in sys_multi_heap_init() argument
12 heap->nheaps = 0; in sys_multi_heap_init()
13 heap->choice = choice_fn; in sys_multi_heap_init()
17 struct sys_heap *heap, void *user_data) in sys_multi_heap_add_heap() argument
21 mheap->heaps[mheap->nheaps].heap = heap; in sys_multi_heap_add_heap()
31 uintptr_t haddr = (uintptr_t)mheap->heaps[j].heap->heap; in sys_multi_heap_add_heap()
61 /* Search the heaps array to find the correct heap in sys_multi_heap_get_heap()
70 haddr = (uintptr_t)mheap->heaps[i].heap->heap; in sys_multi_heap_get_heap()
76 /* Now i stores the index of the heap after our target (even in sys_multi_heap_get_heap()
78 * FIXME: return -ENOENT when a proper heap is not found in sys_multi_heap_get_heap()
[all …]
Dheap.c11 #include "heap.h"
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()
176 "unexpected heap state (double-free?) for memory at %p", mem); in sys_heap_free()
184 "corrupted heap bounds (buffer overflow?) for memory at %p", 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()
[all …]
/Zephyr-latest/tests/lib/heap_align/src/
Dmain.c14 /* Heap metadata sizes */
18 * behavior of the heap in order to exercise coverage of the
19 * underlying code: that chunk headers are 8 bytes, that heap chunks
39 /* Make sure ALL the split memory goes back into the heap and in check_heap_align()
52 zassert_true(sys_heap_validate(h), "heap invalid"); in check_heap_align()
54 zassert_true(p != NULL, "heap not empty"); in check_heap_align()
56 zassert_true(q == NULL, "heap not full"); in check_heap_align()
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()
[all …]
/Zephyr-latest/tests/lib/heap/src/
Dmain.c12 /* 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()
[all …]
/Zephyr-latest/include/zephyr/multi_heap/
Dshared_multi_heap.h9 * @brief Public API for Shared Multi-Heap framework
20 * @brief Heap Management
21 * @defgroup heaps Heap Management
28 * @brief Shared Multi-Heap (SMH) interface
29 * @defgroup shared_multi_heap Shared multi-heap interface
33 * The shared multi-heap manager uses the multi-heap allocator to manage a set
37 * All the different regions can be added at run-time to the shared multi-heap
44 * - At boot time some platform code initialize the shared multi-heap
58 * take care of selecting the correct heap (thus memory region) to carve
60 * heaps (available memory, heap state, etc...)
[all …]
/Zephyr-latest/lib/libc/newlib/
DKconfig15 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-latest/samples/basic/sys_heap/
DREADME.rst1 .. 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
Dsample.yaml2 description: System heap sample showing how to use sys_heap functions
3 name: Basic system heap sample
14 - ".*allocated 0, free ..., max allocated ..., heap size 256.*"
18 - heap
/Zephyr-latest/doc/kernel/memory_management/
Dheap.rst9 Synchronized Heap Allocator
12 Creating a Heap
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
46 Low Level Heap Allocator
56 functions on a single heap must be serialized by the caller.
71 The heap code takes reasonable care to avoid fragmentation. Free
[all …]
Dshared_multi_heap.rst3 Shared Multi Heap
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-latest/samples/basic/sys_heap/src/
Dmain.c13 static struct sys_heap heap; variable
21 printk("System heap sample\n\n"); in main()
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()
43 printk("allocated %zu, free %zu, max allocated %zu, heap size %u\n", in print_sys_memory_stats()
/Zephyr-latest/tests/lib/newlib/heap_listener/src/
Dmain.c18 * Returns the heap end before applying the change.
41 * @brief Test that heap listener is notified when libc heap size changes.
44 * and verifies that the heap listener is notified of allocating or returning
57 TC_PRINT("Total heap size change: %zi\n", heap_difference); in ZTEST()
59 zassert_true(heap_difference > 0, "Heap increase not detected"); in ZTEST()
61 "Heap increase not detected"); in ZTEST()
75 "Heap decrease not detected"); in ZTEST()
/Zephyr-latest/doc/develop/languages/c/
Dcommon_libc.rst25 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.
/Zephyr-latest/subsys/mgmt/mcumgr/grp/settings_mgmt/
DKconfig20 Selects if the stack or heap will be used for variables that are
34 bool "Heap (dynamic size)"
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-latest/modules/lz4/
DKconfig38 bool "in memory heap"
41 Allocate memory from heap (requires malloc()).
62 bool "in memory heap"
65 Allocate memory from heap (requires malloc()).
95 bool "in memory heap"
98 Allocate memory from heap (requires malloc()).
/Zephyr-latest/tests/benchmarks/latency_measure/src/
Dheap_malloc_free.c58 * If count is 0, it means that there is not enough memory heap in heap_malloc_free()
64 notes = "Memory heap too small--increase it."; in heap_malloc_free()
68 "%-40s - Average time for heap malloc", in heap_malloc_free()
69 "heap.malloc.immediate"); in heap_malloc_free()
73 "%-40s - Average time for heap free", in heap_malloc_free()
74 "heap.free.immediate"); in heap_malloc_free()
/Zephyr-latest/drivers/bluetooth/hci/
DKconfig.esp326 prompt "Bluetooth adapter heap in use"
10 bool "Bluetooth adapter use ESP runtime heap"
14 bool "Bluetooth adapter use system heap"
/Zephyr-latest/samples/net/wifi/shell/
Doverlay-enterprise.conf7 # For TLS and X.509 processing MbedTLS needs large heap size and using separate heap
8 # for MbedTLS gives us more control over the heap size.

12345678910>>...12