aboutsummaryrefslogtreecommitdiffstats
path: root/src/tlsf.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-07-03 06:52:51 +0000
committerDavid Robillard <d@drobilla.net>2009-07-03 06:52:51 +0000
commit71cb844f7d7cc6406c66a580fdb37f8c6e36d171 (patch)
tree679a724866ba9ad9fddd28a57c6c9638fb2af1a3 /src/tlsf.h
parent58b9333e2d889abd26ef16eda496c0a47209ab58 (diff)
downloadresp-71cb844f7d7cc6406c66a580fdb37f8c6e36d171.tar.gz
resp-71cb844f7d7cc6406c66a580fdb37f8c6e36d171.tar.bz2
resp-71cb844f7d7cc6406c66a580fdb37f8c6e36d171.zip
Include and use TLSF fast realtime allocator.
git-svn-id: http://svn.drobilla.net/resp/tuplr@171 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/tlsf.h')
-rw-r--r--src/tlsf.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/tlsf.h b/src/tlsf.h
new file mode 100644
index 0000000..6f861ac
--- /dev/null
+++ b/src/tlsf.h
@@ -0,0 +1,49 @@
+/* Two Levels Segregate Fit memory allocator (TLSF)
+ * Version 2.4.4
+ *
+ * Written by Miguel Masmano Tello <mimastel@doctor.upv.es>
+ *
+ * Thanks to Ismael Ripoll for his suggestions and reviews
+ *
+ * Copyright (C) 2008, 2007, 2006, 2005, 2004
+ *
+ * This code is released using a dual license strategy: GPL/LGPL
+ * You can choose the licence that better fits your requirements.
+ *
+ * Released under the terms of the GNU General Public License Version 2.0
+ * Released under the terms of the GNU Lesser General Public License Version 2.1
+ *
+ */
+
+/* This version of TLSF has been modified for Tuplr by David Robillard,
+ * and is not API compatible with TLSF. See http://rtportal.upv.es/rtmalloc/
+ */
+
+#ifndef _TLSF_H_
+#define _TLSF_H_
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct tlsf_s tlsf_t;
+
+extern tlsf_t* tlsf_init(void* area, size_t area_size);
+extern void tlsf_destroy(tlsf_t* tlsf);
+extern size_t tlsf_add_area(tlsf_t* tlsf, void* area, size_t size);
+
+extern size_t tlsf_get_used_size(tlsf_t* tlsf);
+extern size_t tlsf_get_max_size(tlsf_t* tlsf);
+
+extern void* tlsf_malloc(tlsf_t* tlsf, size_t size);
+extern void tlsf_free(tlsf_t* tlsf, void* ptr);
+extern void* tlsf_realloc(tlsf_t* tlsf, void* ptr, size_t new_size);
+extern void* tlsf_calloc(tlsf_t* tlsf, size_t nelem, size_t elem_size);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif