wloop / wlib-malloc

Memory allocator library for WLib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wlib-malloc

malloc and free replacements for WLib using wlib-tlsf.

Install

wio install wlib-malloc

Usage

mem::meminit must be called at program start with a user-provided memory pool for the global allocator instance to manage.

static byte s_pool[POOL_SIZE];

using namespace wlp;

int main(int argc, char *argv[]) {
    mem::init(s_pool, POOL_SIZE);
    
    char *ptr = static_cast<char *>(mem::alloc(128));
    // ...
    mem::free(ptr);
}

About

Memory allocator library for WLib


Languages

Language:C++ 60.3%Language:Shell 23.3%Language:CMake 14.6%Language:C 1.8%