From 0dd38d08551ac2fcff53eb604f6363f37b25aef9 Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 3 Nov 2024 17:35:51 +0200 Subject: env is just linked list now, uses much less memory --- src/memdebug.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/memdebug.h') 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 #include #include +#include #include #include @@ -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 -- cgit v1.2.3