From 59986123b5c6338cb828df26e3a9a0722c92a11f Mon Sep 17 00:00:00 2001 From: Christian Engwer <christi@dune-project.org> Date: Fri, 5 Oct 2012 09:11:42 +0000 Subject: [PATCH] [debugallocator] check scoped new/delete [[Imported from SVN: r7011]] --- dune/common/debug_allocator.hh | 1 + dune/common/test/test-debug-alloc.cc | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/dune/common/debug_allocator.hh b/dune/common/debug_allocator.hh index a3fadcbcd..ef5c3b5b7 100644 --- a/dune/common/debug_allocator.hh +++ b/dune/common/debug_allocator.hh @@ -280,6 +280,7 @@ void operator delete(void * p) throw() #endif Dune::DebugMemory::alloc_man.deallocate<char>(static_cast<char*>(p)); } + #endif // DEBUG_NEW_DELETE #endif // DUNE_DEBUG_ALLOCATOR_HH diff --git a/dune/common/test/test-debug-alloc.cc b/dune/common/test/test-debug-alloc.cc index 0fbe5cf6c..eaedb855b 100644 --- a/dune/common/test/test-debug-alloc.cc +++ b/dune/common/test/test-debug-alloc.cc @@ -79,6 +79,12 @@ void new_delete_tests() z2->foo(); free(buf); z2 = 0; + + std::cout << "alloc A[4]\n"; + A * z4 = ::new A[4]; + z4->foo(); + ::delete[] z4; + z4 = 0; } int main(int argc, char** argv) -- GitLab