Wyatt Hepler | f9fb90f | 2020-09-30 18:59:33 -0700 | [diff] [blame] | 1 | .. _module-pw_malloc: |
Chenghan Zhou | d4f44d2 | 2020-06-18 15:42:06 -0400 | [diff] [blame] | 2 | |
| 3 | --------- |
| 4 | pw_malloc |
| 5 | --------- |
| 6 | |
| 7 | This module defines an interface for replacing the standard libc dynamic memory |
| 8 | operations. |
| 9 | |
| 10 | This facade doesn't implement any heap structure or dynamic memory methods. It |
| 11 | only requires that backends implements a ``void pw_MallocInit();`` method. |
| 12 | This function is called before static intialization, and is responsible for |
| 13 | initializing global data structures required by the malloc implementation. |
| 14 | |
| 15 | The intent of this module is to provide an interface for user-provided dynamic |
| 16 | memory operations that is compatible with different implementations. |
| 17 | |
| 18 | Setup |
| 19 | ===== |
| 20 | This module requires the following setup: |
| 21 | |
| 22 | 1. Chose a ``pw_malloc`` backend, or write one yourself. |
Scott James Remnant | 516255c | 2021-07-22 12:36:11 -0700 | [diff] [blame] | 23 | 2. If using GN build, Specify the ``pw_malloc_BACKEND`` GN build arg to point |
Chenghan Zhou | d4f44d2 | 2020-06-18 15:42:06 -0400 | [diff] [blame] | 24 | the library that provides a ``pw_malloc`` backend. |
| 25 | |
| 26 | Module usage |
| 27 | ============ |
| 28 | See backend docs for how to interact with the underlying dynamic memory |
| 29 | operations implementation. |