-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-mem.c
45 lines (33 loc) · 926 Bytes
/
test-mem.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
#include "v68.h"
#include "v68mem.h"
int main(int argc, char **argv, char **envp) {
struct v68 v;
v68_init(16000000, 2 * 1024 * 1024, 44100);
v68_mem_dump();
uint32_t m1 = v68_mem_alloc(1024, 0);
printf("Allocated 1024B @0x%08x\n", m1);
v68_mem_dump();
uint32_t m2 = v68_mem_alloc(4096, 0);
printf("Allocated 4096B @0x%08x\n", m2);
v68_mem_dump();
uint32_t m3 = v68_mem_alloc(2048, 0);
printf("Allocated 2048B @0x%08x\n", m3);
v68_mem_dump();
uint32_t f = v68_mem_free(m2, 0);
printf("Freed 0x%06x %d\n", m2, f);
v68_mem_dump();
f = v68_mem_free(m1, 0);
printf("Freed 0x%06x %d\n", m1, f);
v68_mem_dump();
uint32_t m4 = v68_mem_alloc(1024, 0);
printf("Allocated 1024B @0x%08x\n", m4);
v68_mem_dump();
f = v68_mem_free(m1, 0);
printf("Freed 0x%06x %d\n", m1, f);
v68_mem_dump();
f = v68_mem_free(m3, 0);
printf("Freed 0x%06x %d\n", m3, f);
v68_mem_dump();
return 0;
}