Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example/Test requested #17

Open
Skips75 opened this issue Jan 4, 2021 · 1 comment
Open

Example/Test requested #17

Skips75 opened this issue Jan 4, 2021 · 1 comment

Comments

@Skips75
Copy link

Skips75 commented Jan 4, 2021

Hi Matt,

If this will be the case, it is possible to have in a future release a couple of examples on how
to use the library? Especially in regards to the initialization step.

@cycl0ne
Copy link

cycl0ne commented Feb 21, 2023

void main()
{
     void *mem= malloc(0x10000);

     tlsf_t* tlsf = tlsf_create_with_pool(mem, 0x10000);

// At this point you can use the malloc/free function from tlsf:

    void *tmem= tlsf_malloc(tlsf, 0x1000); // allocate 4096bytes

    printf("Memory at: %lx, block size: %lx\n, tmem, tlsf_block_size(tmem));
// 
    tlsf_free(tlsf, tmem);  // Free the 4k
    free(mem);
}

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants