Orocos Real-Time Toolkit  2.6.0
tlsf.h
00001 /*
00002  * Two Levels Segregate Fit memory allocator (TLSF)
00003  * Version 2.4.4
00004  *
00005  * Written by Miguel Masmano Tello <mimastel@doctor.upv.es>
00006  *
00007  * Thanks to Ismael Ripoll for his suggestions and reviews
00008  *
00009  * Copyright (C) 2008, 2007, 2006, 2005, 2004
00010  *
00011  * This code is released using a dual license strategy: GPL/LGPL
00012  * You can choose the licence that better fits your requirements.
00013  *
00014  * Released under the terms of the GNU General Public License Version 2.0
00015  * Released under the terms of the GNU Lesser General Public License Version 2.1
00016  *
00017  */
00018 
00019 #ifndef _TLSF_H_
00020 #define _TLSF_H_
00021 
00022 /* We avoid name clashes with other projects and
00023  * only make the required function available
00024  */
00025 #include "../fosi.h"
00026 #define tlsf_malloc oro_rt_malloc
00027 #define tlsf_free oro_rt_free
00028 #define tlsf_realloc oro_rt_realloc
00029 #define tlsf_calloc oro_rt_calloc
00030 
00031 #ifdef  __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 #ifdef ORO_MEMORY_POOL
00036 extern size_t init_memory_pool(size_t, void *);
00037 extern size_t get_used_size(void *);
00038 extern size_t get_max_size(void *);
00039 extern void destroy_memory_pool(void *);
00040 extern size_t add_new_area(void *, size_t, void *);
00041 extern void *malloc_ex(size_t, void *);
00042 extern void free_ex(void *, void *);
00043 extern void *realloc_ex(void *, size_t, void *);
00044 extern void *calloc_ex(size_t, size_t, void *);
00045 #endif
00046 
00047 extern void *tlsf_malloc(size_t size);
00048 extern void tlsf_free(void *ptr);
00049 extern void *tlsf_realloc(void *ptr, size_t size);
00050 extern void *tlsf_calloc(size_t nelem, size_t elem_size);
00051 
00052 #ifdef  __cplusplus
00053 }
00054 #endif
00055 
00056 #endif