Lines Matching full:heap
11 /* multi_heap is a heap implementation for handling multiple
14 Any contiguous block of memory can be registered as a heap.
21 /** @brief Opaque handle to a registered heap */
27 * @param heap Handle to a registered heap.
33 void *multi_heap_aligned_alloc(multi_heap_handle_t heap, size_t size, size_t alignment);
35 /** @brief malloc() a buffer in a given heap
37 …re the same as standard malloc(), only the returned buffer will be allocated in the specified heap.
39 * @param heap Handle to a registered heap.
44 void *multi_heap_malloc(multi_heap_handle_t heap, size_t size);
46 /** @brief free() a buffer aligned in a given heap.
48 * @param heap Handle to a registered heap.
49 … @param p NULL, or a pointer previously returned from multi_heap_aligned_alloc() for the same heap.
52 void __attribute__((deprecated)) multi_heap_aligned_free(multi_heap_handle_t heap, void *p);
54 /** @brief free() a buffer in a given heap.
56 …s standard free(), only the argument 'p' must be NULL or have been allocated in the specified heap.
58 * @param heap Handle to a registered heap.
59 …r a pointer previously returned from multi_heap_malloc() or multi_heap_realloc() for the same heap.
61 void multi_heap_free(multi_heap_handle_t heap, void *p);
63 /** @brief realloc() a buffer in a given heap.
65 …tandard realloc(), only the argument 'p' must be NULL or have been allocated in the specified heap.
67 * @param heap Handle to a registered heap.
68 …r a pointer previously returned from multi_heap_malloc() or multi_heap_realloc() for the same heap.
73 void *multi_heap_realloc(multi_heap_handle_t heap, void *p, size_t size);
78 * @param heap Handle to a registered heap.
79 …t have been previously returned from multi_heap_malloc() or multi_heap_realloc() for the same heap.
84 size_t multi_heap_get_allocated_size(multi_heap_handle_t heap, void *p);
87 /** @brief Register a new heap for use
89 …* This function initialises a heap at the specified address, and returns a handle for future heap …
91 …* There is no equivalent function for deregistering a heap - if all blocks in the heap are free, y…
93 * @param start Start address of the memory to use for a new heap.
94 * @param size Size (in bytes) of the new heap.
96 …* @return Handle of a new heap ready for use, or NULL if the heap region was too small to be initi…
101 /** @brief Associate a private lock pointer with a heap
107 * When the heap is first registered, the associated lock is NULL.
109 * @param heap Handle to a registered heap.
110 * @param lock Optional pointer to a locking structure to associate with this heap.
112 void multi_heap_set_lock(multi_heap_handle_t heap, void* lock);
114 /** @brief Dump heap information to stdout
116 * For debugging purposes, this function dumps information about every block in the heap to stdout.
118 * @param heap Handle to a registered heap.
120 void multi_heap_dump(multi_heap_handle_t heap);
122 /** @brief Check heap integrity
124 …* Walks the heap and checks all heap data structures are valid. If any errors are detected, an err…
130 * @param heap Handle to a registered heap.
132 * @return true if heap is valid, false otherwise.
134 bool multi_heap_check(multi_heap_handle_t heap, bool print_errors);
136 /** @brief Return free heap size
138 * Returns the number of bytes available in the heap.
142 …* Note that the heap may be fragmented, so the actual maximum size for a single malloc() may be lo…
145 * @param heap Handle to a registered heap.
148 size_t multi_heap_free_size(multi_heap_handle_t heap);
150 /** @brief Return the lifetime minimum free heap size
155 * heap.
157 * @param heap Handle to a registered heap.
160 size_t multi_heap_minimum_free_size(multi_heap_handle_t heap);
162 /** @brief Structure to access heap metadata via multi_heap_get_info */
164 …size_t total_free_bytes; ///< Total free bytes in the heap. Equivalent to multi_free_heap_si…
165 size_t total_allocated_bytes; ///< Total bytes allocated to data in the heap.
166 …size_t largest_free_block; ///< Size of the largest free block in the heap. This is the larges…
167 …size_t minimum_free_bytes; ///< Lifetime minimum free heap size. Equivalent to multi_minimum_f…
168 size_t allocated_blocks; ///< Number of (variable size) blocks allocated in the heap.
169 size_t free_blocks; ///< Number of (variable size) free blocks in the heap.
170 size_t total_blocks; ///< Total number of (variable size) blocks in the heap.
173 /** @brief Return metadata about a given heap
175 * Fills a multi_heap_info_t structure with information about the specified heap.
177 * @param heap Handle to a registered heap.
178 * @param info Pointer to a structure to fill with heap metadata.
180 void multi_heap_get_info(multi_heap_handle_t heap, multi_heap_info_t *info);