tlsf.h
Go to the documentation of this file.
1 /*
2  * Two Levels Segregate Fit memory allocator (TLSF)
3  * Version 2.4.6
4  *
5  * Written by Miguel Masmano Tello <mimastel@doctor.upv.es>
6  *
7  * Thanks to Ismael Ripoll for his suggestions and reviews
8  *
9  * Copyright (C) 2008, 2007, 2006, 2005, 2004
10  *
11  * This code is released using a dual license strategy: GPL/LGPL
12  * You can choose the licence that better fits your requirements.
13  *
14  * Released under the terms of the GNU General Public License Version 2.0
15  * Released under the terms of the GNU Lesser General Public License Version 2.1
16  *
17  */
18 
19 #ifndef _TLSF_H_
20 #define _TLSF_H_
21 
22 #include <sys/types.h>
23 
24 /* We avoid name clashes with other projects and
25  * only make the required function available
26  */
27 #include "../fosi.h"
28 #define tlsf_malloc oro_rt_malloc
29 #define tlsf_free oro_rt_free
30 #define tlsf_realloc oro_rt_realloc
31 #define tlsf_calloc oro_rt_calloc
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #ifdef ORO_MEMORY_POOL
38 extern size_t init_memory_pool(size_t, void *);
39 // get size of TLSF pool
40 extern size_t get_pool_size(void *);
41 extern size_t get_pool_size_mp(void);
42 // get size of TLSF overhead
43 extern size_t get_overhead_size(void *);
44 extern size_t get_overhead_size_mp(void);
45 // get currently used size (includes overhead)
46 extern size_t get_used_size(void *);
47 extern size_t get_used_size_mp(void);
48 // get max used size (includes overhead)
49 extern size_t get_max_size(void *);
50 extern size_t get_max_size_mp(void);
51 extern void destroy_memory_pool(void *);
52 extern size_t add_new_area(void *, size_t, void *);
53 extern void *malloc_ex(size_t, void *);
54 extern void free_ex(void *, void *);
55 extern void *realloc_ex(void *, size_t, void *);
56 extern void *calloc_ex(size_t, size_t, void *);
57 #endif
58 
59 extern void *tlsf_malloc(size_t size);
60 extern void tlsf_free(void *ptr);
61 extern void *tlsf_realloc(void *ptr, size_t size);
62 extern void *tlsf_calloc(size_t nelem, size_t elem_size);
63 
64 #if _DEBUG_TLSF_
65 // dump default memory pool to file ff
66 extern void print_tlsf_mp(FILE* ff);
67 // dump all blocks of default memory pool to file ff
68 extern void print_all_blocks_mp(FILE* ff);
69 #endif
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif
#define tlsf_calloc
Definition: tlsf.h:31
void * realloc_ex(void *ptr, size_t new_size, void *mem_pool)
Definition: tlsf.c:929
void * malloc_ex(size_t size, void *mem_pool)
Definition: tlsf.c:811
size_t add_new_area(void *area, size_t area_size, void *mem_pool)
Definition: tlsf.c:546
size_t get_max_size(void *mem_pool)
Definition: tlsf.c:694
void * calloc_ex(size_t nelem, size_t elem_size, void *mem_pool)
Definition: tlsf.c:1021
size_t init_memory_pool(size_t mem_pool_size, void *mem_pool)
Definition: tlsf.c:497
void destroy_memory_pool(void *mem_pool)
Definition: tlsf.c:717
size_t get_overhead_size_mp(void)
Definition: tlsf.c:660
size_t get_used_size_mp(void)
Definition: tlsf.c:683
size_t get_pool_size_mp(void)
Definition: tlsf.c:637
#define tlsf_free
Definition: tlsf.h:29
size_t get_pool_size(void *mem_pool)
Definition: tlsf.c:625
size_t get_overhead_size(void *mem_pool)
Definition: tlsf.c:648
size_t get_max_size_mp(void)
Definition: tlsf.c:706
#define tlsf_realloc
Definition: tlsf.h:30
void free_ex(void *ptr, void *mem_pool)
Definition: tlsf.c:879
size_t get_used_size(void *mem_pool)
Definition: tlsf.c:671
#define tlsf_malloc
Definition: tlsf.h:28


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:37