00001 00002 #include <lua.h> 00003 #include <lauxlib.h> 00004 #include <lualib.h> 00005 00006 #define TLSF_INITIAL_POOLSIZE 1*1024*1024 00007 #undef TLSF_DEBUG 00008 00009 /* this is used as the opque Lua userdata to the alloc func */ 00010 struct lua_tlsf_info { 00011 void *pool; 00012 void *pool2; 00013 unsigned int total_mem; 00014 unsigned int mask; 00015 lua_State *L; 00016 }; 00017 00018 int tlsf_rtt_init_mp(struct lua_tlsf_info *tlsf_inf, size_t sz); 00019 void tlsf_rtt_free_mp(struct lua_tlsf_info *tlsf_inf); 00020 void* tlsf_alloc (void *ud, void *ptr, size_t osize, size_t nsize); 00021 int tlsf_rtt_incmem(struct lua_tlsf_info *tlsf_inf, size_t sz); 00022 void set_context_tlsf_info(struct lua_tlsf_info*); 00023 void register_tlsf_api(lua_State *L); 00024