1 /*
2  * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @brief Allocate memory from the esp_heap_runtime.
9  *
10  * @param size Amount of memory requested (in bytes).
11  *
12  * @return Address of the allocated memory if successful; otherwise NULL.
13  */
14 void *esp_heap_runtime_malloc(size_t size);
15 
16 /**
17  * @brief Allocate memory from esp_heap_runtime, array style
18  *
19  * @param n Number of elements in the requested array
20  * @param size Size of each array element (in bytes).
21  *
22  * @return Address of the allocated memory if successful; otherwise NULL.
23  */
24 void *esp_heap_runtime_calloc(size_t n, size_t size);
25 
26 /**
27  * @brief Reallocate memory from a esp_heap_runtime
28  *
29  * @param ptr Original pointer returned from a previous allocation
30  * @param bytes Desired size of block to allocate
31  *
32  * @return Pointer to memory the caller can now use, or NULL
33  */
34 void *esp_heap_runtime_realloc(void *ptr, size_t bytes);
35 
36 /**
37  * @brief Free memory allocated from esp_heap_runtime.
38  *
39  * If @a ptr is NULL, no operation is performed.
40  *
41  * @param ptr Pointer to previously allocated memory.
42  */
43 void esp_heap_runtime_free(void *mem);
44