summaryrefslogtreecommitdiff
path: root/mysys/my_new.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-12-12 22:58:24 +0100
committerSergei Golubchik <sergii@pisem.net>2011-12-12 22:58:24 +0100
commit6cc9d0ffa0b6d9d0f19cf9445fad0e0ba11e38f8 (patch)
tree6952bb89985c14f7ad5e362dd350d191cadd0d69 /mysys/my_new.cc
parent37c81d81b3940a21b500aff6aeb70e8b1df0b7e8 (diff)
downloadmariadb-git-6cc9d0ffa0b6d9d0f19cf9445fad0e0ba11e38f8.tar.gz
move safemalloc out of dbug.
remeber a real backtrace for every allocation. make safemalloc to tract C++ new/delete too. collateral fixes to make the test suite pass.
Diffstat (limited to 'mysys/my_new.cc')
-rw-r--r--mysys/my_new.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/mysys/my_new.cc b/mysys/my_new.cc
index 377d9be22a8..8724f9cc4a4 100644
--- a/mysys/my_new.cc
+++ b/mysys/my_new.cc
@@ -16,7 +16,10 @@
/*
This is a replacement of new/delete operators to be used when compiling
- with gcc 3.0.x to avoid including libstdc++
+ with gcc 3.0.x to avoid including libstdc++
+
+ It is also used to make all memory allocations to go through
+ my_malloc/my_free wrappers (for debugging/safemalloc and accounting)
*/
#include "mysys_priv.h"
@@ -25,24 +28,22 @@
void *operator new (size_t sz)
{
- return (void *) malloc (sz ? sz : 1);
+ return (void *) my_malloc (sz ? sz : 1, MYF(0));
}
void *operator new[] (size_t sz)
{
- return (void *) malloc (sz ? sz : 1);
+ return (void *) my_malloc (sz ? sz : 1, MYF(0));
}
void operator delete (void *ptr)
{
- if (ptr)
- free(ptr);
+ my_free(ptr);
}
void operator delete[] (void *ptr) throw ()
{
- if (ptr)
- free(ptr);
+ my_free(ptr);
}
C_MODE_START