-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_alloc.c
More file actions
38 lines (31 loc) · 1.2 KB
/
test_alloc.c
File metadata and controls
38 lines (31 loc) · 1.2 KB
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
#include "../hash/crc32c.c"
#include "../parser/metac_identifier_table.c"
#include "../os/os.c"
#include "../os/metac_alloc.c"
int main(int argc, const char* argv[])
{
void* mem = 0;
metac_alloc_t mainAlloc;
Allocator_Init(&mainAlloc, 0);
printf("Allocator_File: %s\n",
IdentifierPtrToCharPtr(&g_filenames, mainAlloc.FileID));
printf("Allocator.AllocatedBlocks: %u\n",
mainAlloc.AllocatedBlocks);
// printf("Allocator.Used: %u\n");
tagged_arena_t* firstA = &mainAlloc.Arenas[0];
printf("firstA.Memory: %p\n", firstA->Memory);
printf("firstA.SizeLeft: %d\n", firstA->SizeLeft);
printf("firstA.Offset: %d\n", firstA->Offset);
for(uint32_t i = 0; i < 5; i++)
{
uint32_t allocSize = 3000 * i;
printf("Allocate(%u)\n", allocSize);
tagged_arena_t* arena = Allocate(&mainAlloc, allocSize);
printf("Allocation.Memory: %p\n", arena->Memory);
printf("Allocation.SizeLeft: %d\n", arena->SizeLeft);
printf("Allocation.Offset: %d\n", arena->Offset);
printf("firstA.Memory: %p\n", firstA->Memory);
printf("firstA.SizeLeft: %d\n", firstA->SizeLeft);
printf("firstA.Offset: %d\n", firstA->Offset);
}
}