summaryrefslogtreecommitdiff
path: root/src/lib/mpmalloc.cc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-12-14 07:44:57 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-12-14 07:44:57 +0100
commitbf836e01ba9e64b1b7b9035c7efab9cb3ffc0da8 (patch)
treec3345652b536a43fdbf2d8c17b4f0149f38cc8b7 /src/lib/mpmalloc.cc
parent566e698caf23dc034335cfbb05641726ec4c273b (diff)
also trace realloc calls
Diffstat (limited to 'src/lib/mpmalloc.cc')
-rw-r--r--src/lib/mpmalloc.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/mpmalloc.cc b/src/lib/mpmalloc.cc
index db4a87a..2483a3a 100644
--- a/src/lib/mpmalloc.cc
+++ b/src/lib/mpmalloc.cc
@@ -2,7 +2,8 @@
#include "driver/stdout.h"
#include "lib/mpmalloc.h"
-void* mpcalloc(size_t nmemb, size_t size) {
+void* mpcalloc(size_t nmemb, size_t size)
+{
void* ret = calloc(nmemb, size);
#ifdef ADDR_20BIT
kout << "calloc:" << dec << (uint32_t)nmemb << "x" << (uint32_t)size << "@" << ret << endl;
@@ -12,7 +13,8 @@ void* mpcalloc(size_t nmemb, size_t size) {
return ret;
}
-void* mpmalloc(size_t size) {
+void* mpmalloc(size_t size)
+{
void* ret = malloc(size);
#ifdef ADDR_20BIT
kout << "malloc:" << dec << (uint32_t)size << "@" << ret << endl;
@@ -22,7 +24,19 @@ void* mpmalloc(size_t size) {
return ret;
}
-void mpfree(void* addr) {
+void* mprealloc(void* addr, size_t size)
+{
+ void* ret = realloc(addr, size);
+#ifdef ADDR_20BIT
+ kout << "realloc:" << addr << ":" << dec << (uint32_t)size << "@" << ret << endl;
+#else
+ kout << "realloc:" << addr << ":" << dec << size << "@" << ret << endl;
+#endif
+ return ret;
+}
+
+void mpfree(void* addr)
+{
kout << "free:" << addr << endl;
free(addr);
}