Dune Core Modules (2.4.1)

Dune::DebugAllocator< T > Class Template Reference

Allocators implementation which performs different kind of memory checks. More...

#include <dune/common/debugallocator.hh>

Public Member Functions

 DebugAllocator () throw ()
 create a new DebugAllocator
 
template<class U >
 DebugAllocator (const DebugAllocator< U > &) throw ()
 copy construct from an other DebugAllocator, possibly for a different result type
 
 ~DebugAllocator () throw ()
 cleanup this allocator
 
pointer allocate (size_type n, DebugAllocator< void >::const_pointer hint=0)
 allocate n objects of type T
 
void deallocate (pointer p, size_type n)
 deallocate n objects of type T at address p
 
size_type max_size () const throw ()
 max size for allocate
 
void construct (pointer p, const T &val)
 copy-construct an object of type T (i.e. make a placement new on p)
 
template<typename ... _Args>
void construct (pointer p, _Args &&... __args)
 construct an object of type T from variadic parameters
 
void destroy (pointer p)
 destroy an object of type T (i.e. call the destructor)
 

Detailed Description

template<class T>
class Dune::DebugAllocator< T >

Allocators implementation which performs different kind of memory checks.

We check:

  • access past the end
  • only free memory which was allocated with this allocator
  • list allocated memory chunks still in use upon destruction of the allocator

When defining DEBUG_ALLOCATOR_KEEP to 1, we also check

  • double free
  • access after free

When defining DEBUG_NEW_DELETE >= 1, we

  • overload new/delte
  • use the Debug memory management for new/delete
  • DEBUG_NEW_DELETE > 2 gives extensive debug output

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)