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
6
char
*
pool
;
7
void
**
pointers
;
// Wont fill this, but better safe
8
9
int
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
}
malloc.h
main
int main(int argc, char *argv[])
Definition
test.c:9
pool
char * pool
Definition
test.c:6
POOL_SIZE
#define POOL_SIZE
Definition
test.c:4
pointers
void ** pointers
Definition
test.c:7
ALLOC_SIZE
#define ALLOC_SIZE
Definition
test.c:5
src
alloc
dlmalloc
test.c
Generated by
1.13.2