blob: 101f328efc9c54c8a38a2088cdab72b2648691d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#ifndef __MICRO_MEM_H__
#define __MICRO_MEM_H__
#include <stdlib.h>
// NOTE: Overrides GLFW allocator
void init_mem(void);
void deinit_mem(void);
void free_temp_allocs(void);
// Temp allocation. Freed at the end of every frame. Do NOT realloc.
void *mem_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 *mem_alloc(size_t size);
void *mem_realloc(void *ptr, size_t new_size);
void mem_free(void *ptr);
// Returns -1 in release builds.
int alloc_count(void);
#endif // __MICRO_MEM_H__
|