KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
malloc.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 machine/malloc.h
4 Copyright (C) 2003 Megan Potter
5 Copyright (C) 2015 Lawrence Sebald
6 Copyright (C) 2025 Donald Haase
7
8*/
9
10/** \file malloc.h
11 \brief KOS-specific Allocator functionality
12 \ingroup system_allocator
13
14 This implements custom KOS extensions to allocator functionality.
15
16 \author Megan Potter
17 \author Lawrence Sebald
18 \author Donald Haase
19*/
20
21#ifndef __MACHINE_MALLOC_H
22#define __MACHINE_MALLOC_H
23
24#include <sys/cdefs.h>
25__BEGIN_DECLS
26
27/** \defgroup system_allocator Allocator Extensions
28 \brief KOS custom allocator extensions
29 \ingroup system
30
31 @{
32*/
33
34/* mallopt default defines */
35#define DEFAULT_MXFAST 64
36
37#define DEFAULT_TRIM_THRESHOLD (256*1024)
38
39#define DEFAULT_TOP_PAD 0
40
41#define DEFAULT_MMAP_THRESHOLD (256*1024)
42
43#define DEFAULT_MMAP_MAX 65536
44
45/** \brief Determine if it is safe to call malloc() in an IRQ context.
46
47 This function checks the value of the internal spinlock that is used for
48 malloc() to ensure that a call to it will not freeze the running process.
49 This is only really useful in an IRQ context to ensure that a call to
50 malloc() (or some other memory allocation function) won't cause a deadlock.
51
52 \retval 1 If it is safe to call malloc() in the current IRQ.
53 \retval 0 Otherwise.
54*/
56
57/** \brief Only available with KM_DBG
58*/
59int mem_check_block(void *p);
60
61/** \brief Only available with KM_DBG
62 */
63int mem_check_all(void);
64
65/** @} */
66
67__END_DECLS
68
69#endif /* __MACHINE_MALLOC_H */
int mem_check_block(void *p)
Only available with KM_DBG.
int malloc_irq_safe(void)
Determine if it is safe to call malloc() in an IRQ context.
int mem_check_all(void)
Only available with KM_DBG.