diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-11-03 17:35:51 +0200 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-11-03 17:35:51 +0200 |
commit | 0dd38d08551ac2fcff53eb604f6363f37b25aef9 (patch) | |
tree | b9c29e5c0a3467cc6fbec72fb292e5414a8c7f4b /src/memdebug.h | |
parent | 7edffea39a3d666098ebeca27ea398769e8b981b (diff) |
env is just linked list now, uses much less memory
Diffstat (limited to 'src/memdebug.h')
-rw-r--r-- | src/memdebug.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/memdebug.h b/src/memdebug.h index 7d72a10..c318656 100644 --- a/src/memdebug.h +++ b/src/memdebug.h @@ -22,6 +22,8 @@ void *__memdebug_calloc(size_t nmemb, size_t size, char *file, int line); void *__memdebug_realloc(void *ptr, size_t size, char *file, int line); void __memdebug_free(void *ptr, char *file, int line); +int memdebug_log(char *format, ...); + #ifdef MEMDEBUG_IMPLEMENTATION // Default memory allocation functions @@ -66,6 +68,7 @@ typedef long long int memdebug_suffix; #include <stdlib.h> #include <stdint.h> #include <string.h> +#include <stdarg.h> #include <errno.h> #include <time.h> @@ -95,6 +98,18 @@ static inline void *memdebug_add_out_of_bounds_check(void *addr, size_t size) return (void *)((uintptr_t)addr + sizeof(size)); } +int memdebug_log(char *format, ...) +{ + int ret = 0; + va_list args; + + va_start(args, format); + ret = vfprintf(_memdebug_fp, format, args); + va_end(args); + + return ret; +} + void *__memdebug_malloc(size_t size, char *file, int line) { #ifndef MEMDEBUG_OUT_OF_BOUNDS |