1 /* malloc.h -- header file for memory routines. */
3 #ifndef _INCLUDE_MALLOC_H_
4 #define _INCLUDE_MALLOC_H_
16 /* This version of struct mallinfo must match the one in
17 libc/stdlib/mallocr.c. */
20 int arena
; /* total space allocated from system */
21 int ordblks
; /* number of non-inuse chunks */
22 int smblks
; /* unused -- always zero */
23 int hblks
; /* number of mmapped regions */
24 int hblkhd
; /* total space in mmapped regions */
25 int usmblks
; /* unused -- always zero */
26 int fsmblks
; /* unused -- always zero */
27 int uordblks
; /* total allocated space */
28 int fordblks
; /* total non-inuse space */
29 int keepcost
; /* top-most, releasable (via malloc_trim) space */
34 extern _PTR malloc
_PARAMS ((size_t));
35 extern _PTR _malloc_r
_PARAMS ((struct _reent
*, size_t));
37 extern _VOID free
_PARAMS ((_PTR
));
38 extern _VOID _free_r
_PARAMS ((struct _reent
*, _PTR
));
40 extern _PTR realloc
_PARAMS ((_PTR
, size_t));
41 extern _PTR _realloc_r
_PARAMS ((struct _reent
*, _PTR
, size_t));
43 extern _PTR calloc
_PARAMS ((size_t, size_t));
44 extern _PTR _calloc_r
_PARAMS ((struct _reent
*, size_t, size_t));
46 extern _PTR memalign
_PARAMS ((size_t, size_t));
47 extern _PTR _memalign_r
_PARAMS ((struct _reent
*, size_t, size_t));
49 extern struct mallinfo mallinfo
_PARAMS ((void));
50 extern struct mallinfo _mallinfo_r
_PARAMS ((struct _reent
*));
52 extern void malloc_stats
_PARAMS ((void));
53 extern void _malloc_stats_r
_PARAMS ((struct _reent
*));
55 extern int mallopt
_PARAMS ((int, int));
56 extern int _mallopt_r
_PARAMS ((struct _reent
*, int, int));
58 extern size_t malloc_usable_size
_PARAMS ((_PTR
));
59 extern size_t _malloc_usable_size_r
_PARAMS ((struct _reent
*, _PTR
));
61 /* These aren't too useful on an embedded system, but we define them
64 extern _PTR valloc
_PARAMS ((size_t));
65 extern _PTR _valloc_r
_PARAMS ((struct _reent
*, size_t));
67 extern _PTR pvalloc
_PARAMS ((size_t));
68 extern _PTR _pvalloc_r
_PARAMS ((struct _reent
*, size_t));
70 extern int malloc_trim
_PARAMS ((size_t));
71 extern int _malloc_trim_r
_PARAMS ((struct _reent
*, size_t));
73 /* A compatibility routine for an earlier version of the allocator. */
75 extern _VOID mstats
_PARAMS ((char *));
76 extern _VOID _mstats_r
_PARAMS ((struct _reent
*, char *));
78 /* SVID2/XPG mallopt options */
80 #define M_MXFAST 1 /* UNUSED in this malloc */
81 #define M_NLBLKS 2 /* UNUSED in this malloc */
82 #define M_GRAIN 3 /* UNUSED in this malloc */
83 #define M_KEEP 4 /* UNUSED in this malloc */
85 /* mallopt options that actually do something */
87 #define M_TRIM_THRESHOLD -1
89 #define M_MMAP_THRESHOLD -3
92 #if !defined (__CYGWIN__) && !defined (__MSYS__)
93 /* Some systems provide this, so do too for compatibility. */
94 extern void cfree
_PARAMS ((_PTR
));
95 #endif /* not __CYGWIN__ and not __MSYS__ */
101 #endif /* _INCLUDE_MALLOC_H_ */