Skip to content
Snippets Groups Projects
Commit 6e5874cf authored by Christian Engwer's avatar Christian Engwer
Browse files

[debugallocator]

use mallocallocator for book-keeping-containers
... make new/delete work

[[Imported from SVN: r7010]]
parent 104d9c64
No related branches found
No related tags found
No related merge requests found
...@@ -5,11 +5,15 @@ ...@@ -5,11 +5,15 @@
#include <exception> #include <exception>
#include <typeinfo> #include <typeinfo>
#include <malloc.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <cstring> #include <cstring>
#include <cstdlib>
#include <malloc.h>
#include <new>
#include "mallocallocator.hh"
namespace Dune namespace Dune
{ {
...@@ -47,7 +51,8 @@ namespace Dune ...@@ -47,7 +51,8 @@ namespace Dune
bool not_free; bool not_free;
}; };
typedef std::vector<AllocationInfo> AllocationList; typedef MallocAllocator<AllocationInfo> Alloc;
typedef std::vector<AllocationInfo, Alloc> AllocationList;
AllocationList allocation_list; AllocationList allocation_list;
private: private:
...@@ -151,7 +156,7 @@ namespace Dune ...@@ -151,7 +156,7 @@ namespace Dune
memprotect(it->page_ptr, memprotect(it->page_ptr,
(it->pages) * page_size, (it->pages) * page_size,
PROT_READ | PROT_WRITE); PROT_READ | PROT_WRITE);
free(it->page_ptr); std::free(it->page_ptr);
// remove chunk info // remove chunk info
allocation_list.erase(it); allocation_list.erase(it);
#endif #endif
...@@ -169,7 +174,7 @@ namespace Dune ...@@ -169,7 +174,7 @@ namespace Dune
template<class T> template<class T>
class DebugAllocator; class DebugAllocator;
// specialize for void: // specialize for void
template <> template <>
class DebugAllocator<void> { class DebugAllocator<void> {
public: public:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#endif #endif
// #define DEBUG_ALLOCATOR_KEEP 1 // #define DEBUG_ALLOCATOR_KEEP 1
// #define DEBUG_NEW_DELETE 3 #define DEBUG_NEW_DELETE 3
#include <dune/common/debug_allocator.hh> #include <dune/common/debug_allocator.hh>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment