1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _PICO_MALLOC_H 8 #define _PICO_MALLOC_H 9 10 /** \file malloc.h 11 * \defgroup pico_malloc pico_malloc 12 * 13 * \brief Multi-core safety for malloc, calloc and free 14 * 15 * This library does not provide any additional functions 16 */ 17 18 // PICO_CONFIG: PICO_USE_MALLOC_MUTEX, Whether to protect malloc etc with a mutex, type=bool, default=1 with pico_multicore, 0 otherwise, group=pico_malloc 19 #if LIB_PICO_MULTICORE && !defined(PICO_USE_MALLOC_MUTEX) 20 #define PICO_USE_MALLOC_MUTEX 1 21 #endif 22 23 // PICO_CONFIG: PICO_MALLOC_PANIC, Enable/disable panic when an allocation failure occurs, type=bool, default=1, group=pico_malloc 24 #ifndef PICO_MALLOC_PANIC 25 #define PICO_MALLOC_PANIC 1 26 #endif 27 28 // PICO_CONFIG: PICO_DEBUG_MALLOC, Enable/disable debug printf from malloc, type=bool, default=0, group=pico_malloc 29 #ifndef PICO_DEBUG_MALLOC 30 #define PICO_DEBUG_MALLOC 0 31 #endif 32 33 // PICO_CONFIG: PICO_DEBUG_MALLOC_LOW_WATER, Define the lower bound for allocation addresses to be printed by PICO_DEBUG_MALLOC, min=0, default=0, group=pico_malloc 34 #ifndef PICO_DEBUG_MALLOC_LOW_WATER 35 #define PICO_DEBUG_MALLOC_LOW_WATER 0 36 #endif 37 38 #endif