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