summaryrefslogtreecommitdiff
path: root/tests/arena_tests.c
diff options
context:
space:
mode:
authorOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-25 11:02:46 +1100
committerOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-25 11:02:46 +1100
commit4b9ab2ec5acf2ecf2e96c38733a835b964664171 (patch)
tree3a20f08c99e9f5036bccf7916cec56fbb7fd0ec0 /tests/arena_tests.c
parent1e1facd09ade50ffaf421cffe53ff7ddddab2793 (diff)
add an arena allocator first impl
Diffstat (limited to 'tests/arena_tests.c')
-rw-r--r--tests/arena_tests.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/arena_tests.c b/tests/arena_tests.c
new file mode 100644
index 0000000..88fc21b
--- /dev/null
+++ b/tests/arena_tests.c
@@ -0,0 +1,12 @@
+/*
+size_t arena_size = 16;
+ arena scratch = arena_create(malloc(arena_size), arena_size);
+
+ i32* int_ptr = arena_alloc(&scratch, sizeof(i32));
+ i32* b = arena_alloc(&scratch, sizeof(i32));
+ i32* c = arena_alloc(&scratch, sizeof(i32));
+ *int_ptr = 55;
+ printf("Int pointer %d %p\n", (*int_ptr), int_ptr);
+
+ // will abort on second arena alloc
+*/ \ No newline at end of file