Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
Loading...
Searching...
No Matches
test.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3#include "malloc.h"
4#define POOL_SIZE 1024 * 1024 * 1024
5#define ALLOC_SIZE 1024
6char *pool;
7void **pointers; // Wont fill this, but better safe
8
9int main(int argc, char *argv[])
10{
11 int allocs = 0;
12
13 pool = malloc(POOL_SIZE);
14 pointers = malloc((POOL_SIZE / ALLOC_SIZE) * sizeof(void *));
15
16 mspace mem = create_mspace_with_base(pool, POOL_SIZE, 1);
17
18 while ( (pointers[allocs] = mspace_malloc(mem, ALLOC_SIZE)) ) {
19 allocs++;
20 }
21 printf("Allocations: %d\n", allocs);
22 mspace_bulk_free(mem, pointers, allocs);
23
24 free(pointers);
25 free(pool);
26
27 return 0;
28}
int main(int argc, char *argv[])
Definition test.c:9
char * pool
Definition test.c:6
#define POOL_SIZE
Definition test.c:4
void ** pointers
Definition test.c:7
#define ALLOC_SIZE
Definition test.c:5