supernova: allocators - fix construct method
[supercollider.git] / external_libraries / TLSF-2.4.6 / examples / test3.c
blobd1a4b4fb19d398e2dc969c29eacba8d376de630c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "tlsf.h"
5 #define POOL_SIZE 1024 * 10
8 // Pool size is in bytes.
9 char p0[POOL_SIZE];
10 char p1[POOL_SIZE];
11 char p2[POOL_SIZE];
12 char p3[POOL_SIZE];
14 int main(void){
15 char *ptr;
17 printf("Pools' addresses: (0) %p (1) %p (2) %p (3) %p\n", p0, p1, p2, p3);
18 init_memory_pool(POOL_SIZE, p0);
19 add_new_area(p3, POOL_SIZE, p0);
20 add_new_area(p1, POOL_SIZE, p0);
21 add_new_area(p2, POOL_SIZE, p0);
23 if (!(ptr=malloc_ex(POOL_SIZE*2, p0))){
24 printf("Error\n");
25 exit(-1);
28 free_ex(ptr, p0);
30 destroy_memory_pool(p0);
31 printf("Test OK\n");
32 exit(0);