pw_malloc#

Pigweed AI summary: The pw_malloc module provides an interface for replacing the standard libc dynamic memory operations. It does not implement any heap structure or dynamic memory methods, but requires backends to implement a pw_MallocInit() method for initializing global data structures. The module is intended to provide a compatible interface for user-provided dynamic memory operations. To use the module, a pw_malloc backend must be chosen or written, and if using GN build, the pw_malloc_BACKEND GN build arg must be specified. See backend docs for

This module defines an interface for replacing the standard libc dynamic memory operations.

This facade doesn’t implement any heap structure or dynamic memory methods. It only requires that backends implements a void pw_MallocInit(); method. This function is called before static intialization, and is responsible for initializing global data structures required by the malloc implementation.

The intent of this module is to provide an interface for user-provided dynamic memory operations that is compatible with different implementations.

Setup#

Pigweed AI summary: This module requires a setup that includes choosing a pw_malloc backend or creating one, and specifying the pw_malloc_BACKEND GN build arg if using GN build to point to the library that provides a pw_malloc backend.

This module requires the following setup:

  1. Chose a pw_malloc backend, or write one yourself.

  2. If using GN build, Specify the pw_malloc_BACKEND GN build arg to point the library that provides a pw_malloc backend.

Module usage#

Pigweed AI summary: The "Module usage" section provides information on how to interact with the dynamic memory operations implementation, and directs readers to consult the backend documentation for more details.

See backend docs for how to interact with the underlying dynamic memory operations implementation.