Open atticus5 opened 3 years ago
Yes, all memory allocations are defined with malloc, so just override malloc with your own call. Remember to revert the malloc redef at the end. This can be done on a per container basis, so it's pretty useful!
void* my_malloc(size_t size) { .... }
#define malloc my_malloc
#define P
#define T int
#include <vec.h>
#undef my_malloc
@glouw but can't do the same for free unfortunatelly, cause it is used as a suffix, unless I change it
Would like to also have the ability to define a custom memory allocator as we do for free and copy functions.