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 @@
#include <exception>
#include <typeinfo>
#include <malloc.h>
#include <sys/mman.h>
#include <vector>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <malloc.h>
#include <new>
#include "mallocallocator.hh"
namespace Dune
{
......@@ -47,7 +51,8 @@ namespace Dune
bool not_free;
};
typedef std::vector<AllocationInfo> AllocationList;
typedef MallocAllocator<AllocationInfo> Alloc;
typedef std::vector<AllocationInfo, Alloc> AllocationList;
AllocationList allocation_list;
private:
......@@ -151,7 +156,7 @@ namespace Dune
memprotect(it->page_ptr,
(it->pages) * page_size,
PROT_READ | PROT_WRITE);
free(it->page_ptr);
std::free(it->page_ptr);
// remove chunk info
allocation_list.erase(it);
#endif
......@@ -169,7 +174,7 @@ namespace Dune
template<class T>
class DebugAllocator;
// specialize for void:
// specialize for void
template <>
class DebugAllocator<void> {
public:
......
......@@ -5,7 +5,7 @@
#endif
// #define DEBUG_ALLOCATOR_KEEP 1
// #define DEBUG_NEW_DELETE 3
#define DEBUG_NEW_DELETE 3
#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