• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _MALLOC_H
2 #define _MALLOC_H
3 
4 #include <stdio.h>
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #define __NEED_size_t
11 #define __NEED_ssize_t
12 #define __NEED_uintptr_t
13 
14 #include <bits/alltypes.h>
15 
16 void *malloc (size_t);
17 void *calloc (size_t, size_t);
18 void *realloc (void *, size_t);
19 void free (void *);
20 void *valloc (size_t);
21 void *memalign(size_t, size_t);
22 
23 size_t malloc_usable_size(void *);
24 
25 #define __MALLINFO_BODY \
26   size_t arena; \
27   size_t ordblks; \
28   size_t smblks; \
29   size_t hblks; \
30   size_t hblkhd; \
31   size_t usmblks; \
32   size_t fsmblks; \
33   size_t uordblks; \
34   size_t fordblks; \
35   size_t keepcost;
36 
37 struct mallinfo { __MALLINFO_BODY };
38 
39 struct mallinfo mallinfo(void);
40 
41 struct mallinfo2 { __MALLINFO_BODY };
42 
43 struct mallinfo2 mallinfo2(void);
44 
45 int malloc_iterate(void* base, size_t size, void (*callback)(void* base, size_t size, void* arg), void* arg);
46 void malloc_disable(void);
47 void malloc_enable(void);
48 
49 int malloc_info(int options, FILE* fp);
50 void malloc_stats_print(void (*write_cb) (void *, const char *), void *cbopaque, const char *opts);
51 
52 
53 #define M_SET_THREAD_CACHE -1001
54 #define M_THREAD_CACHE_ENABLE 1
55 #define M_THREAD_CACHE_DISABLE 0
56 
57 #define M_FLUSH_THREAD_CACHE -1002
58 
59 #define M_DELAYED_FREE -1003
60 #define M_DELAYED_FREE_ENABLE 1
61 #define M_DELAYED_FREE_DISABLE 0
62 
63 int mallopt(int param, int value);
64 ssize_t malloc_backtrace(void* pointer, uintptr_t* frames, size_t frame_count);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif
71