From 576bd27e11ec70bdbd1b9a644d2e227b57586337 Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Sun, 10 May 2026 00:28:14 -0400 Subject: i ain't splitting alla this up --- teensy/teensy_mem.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 teensy/teensy_mem.h (limited to 'teensy/teensy_mem.h') diff --git a/teensy/teensy_mem.h b/teensy/teensy_mem.h new file mode 100644 index 0000000..da2fed9 --- /dev/null +++ b/teensy/teensy_mem.h @@ -0,0 +1,24 @@ +#ifndef TEENSY_MEM_H_ +#define TEENSY_MEM_H_ + +#include + +// NOTE: Overrides GLFW allocator +void ty_init_mem(void); +void ty_deinit_mem(void); +void ty_free_temp_allocs(void); +// Temp allocation. Freed at the end of every frame. Do NOT realloc. +void *ty_talloc(size_t size); + +// These mem_* functions handle the case of a bad allocation. No need to check +// for NULL after allocating with these. In debug builds, they will also track +// allocations and report any memory still in use when the program exits. + +void *ty_alloc(size_t size); +void *ty_realloc(void *ptr, size_t new_size); +void ty_free(void *ptr); + +// Returns -1 in release builds. +int ty_alloc_count(void); + +#endif // TEENSY_MEM_H_ -- cgit v1.3-2-g0d8e