aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2014-10-25 21:53:48 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org> 2014-10-25 21:53:48 +0200
commitf1bd09fc21e607b7d3fea1a8db57b8115d849c13 (patch)
tree7e429990bb966b4a9aa896d9bc1b20753809f159
parent42074c795766ce28d82827649824c7ea30306370 (diff)
downloadcolorize-f1bd09fc21e607b7d3fea1a8db57b8115d849c13.tar.gz
colorize-f1bd09fc21e607b7d3fea1a8db57b8115d849c13.tar.bz2
Print memory allocation diagnostics
-rw-r--r--colorize.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/colorize.c b/colorize.c
index 5729f0e..cf0c047 100644
--- a/colorize.c
+++ b/colorize.c
@@ -1007,6 +1007,7 @@ malloc_wrap_debug (size_t size, const char *file, unsigned int line)
void *p = malloc (size);
if (!p)
MEM_ALLOC_FAIL_DEBUG (file, line);
+ vfprintf_diag ("malloc'ed %lu bytes [file %s, line %u]", (unsigned long)size, file, line);
return p;
}
@@ -1016,6 +1017,7 @@ calloc_wrap_debug (size_t nmemb, size_t size, const char *file, unsigned int lin
void *p = calloc (nmemb, size);
if (!p)
MEM_ALLOC_FAIL_DEBUG (file, line);
+ vfprintf_diag ("calloc'ed %lu bytes [file %s, line %u]", (unsigned long)(nmemb * size), file, line);
return p;
}
@@ -1025,6 +1027,7 @@ realloc_wrap_debug (void *ptr, size_t size, const char *file, unsigned int line)
void *p = realloc (ptr, size);
if (!p)
MEM_ALLOC_FAIL_DEBUG (file, line);
+ vfprintf_diag ("realloc'ed %lu bytes [file %s, line %u]", (unsigned long)size, file, line);
return p;
}
#endif /* !DEBUG */