21 #include <RCF/test/Test.hpp>
24 #include <RCF/test/StackWalker.h>
28 std::string toString()
const {
return "<Call stack unavailable>"; }
32 bool gInstrumented =
false;
33 bool gExpectAllocations =
true;
34 std::size_t gnAllocations = 0;
37 void *
operator new(
size_t bytes)
42 if (!gExpectAllocations)
47 gInstrumented =
false;
49 std::cout <<
"***************************************" << std::endl;
50 std::cout <<
"Unexpected memory allocation. Call stack:" << std::endl;
52 std::cout << StackTrace().toString() << std::endl;
54 std::cout <<
"***************************************" << std::endl;
56 RCF_CHECK(0 &&
"Unexpected memory allocation.");
64 void operator delete (
void *pv)
throw()
69 void *
operator new [](
size_t bytes)
74 if (!gExpectAllocations)
79 gInstrumented =
false;
80 RCF_CHECK(gExpectAllocations);
81 std::cout <<
"Unexpected memory allocation." << std::endl;
89 void operator delete [](
void *pv)
throw()