From 92a6d42b8e270779fc7b9eb96488195611948d21 Mon Sep 17 00:00:00 2001
From: Christian Engwer <christi@dune-project.org>
Date: Fri, 5 Oct 2012 09:11:57 +0000
Subject: [PATCH] [doc] add documentation for allocators

[[Imported from SVN: r7018]]
---
 doc/doxygen/modules            |  6 ++++++
 dune/common/debugallocator.hh  | 23 ++++++++++++++++++++++-
 dune/common/mallocallocator.hh |  5 ++++-
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/doc/doxygen/modules b/doc/doxygen/modules
index cf61aaabc..74b942b27 100644
--- a/doc/doxygen/modules
+++ b/doc/doxygen/modules
@@ -1,3 +1,9 @@
 /**
   @defgroup Common Common (foundation classes)
 */
+
+/**
+  @defgroup Allocators Allocators
+  @brief Implementations of the STL allocator concept
+  @ingroup Common
+*/
diff --git a/dune/common/debugallocator.hh b/dune/common/debugallocator.hh
index 5de7fa5a9..0f5c92672 100644
--- a/dune/common/debugallocator.hh
+++ b/dune/common/debugallocator.hh
@@ -21,6 +21,8 @@ enum DummyProtFlags { PROT_NONE, PROT_WRITE, PROT_READ };
 
 namespace Dune
 {
+
+#ifndef DOXYGEN // hide implementation details from doxygen
   namespace DebugMemory
   {
 
@@ -177,7 +179,8 @@ namespace Dune
 #undef ALLOCATION_ASSERT
 
     extern AllocationManager alloc_man;
-  }
+  }   // end namespace DebugMemory
+#endif // DOXYGEN
 
   template<class T>
   class DebugAllocator;
@@ -196,6 +199,24 @@ namespace Dune
   };
 
   // actual implementation
+  /**
+     @ingroup Allocators
+     @brief 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
+   */
   template <class T>
   class DebugAllocator {
   public:
diff --git a/dune/common/mallocallocator.hh b/dune/common/mallocallocator.hh
index 41c2a6ef7..58c454d15 100644
--- a/dune/common/mallocallocator.hh
+++ b/dune/common/mallocallocator.hh
@@ -9,7 +9,10 @@
 
 namespace Dune
 {
-  //! allocator which simply calls malloc/free
+  /**
+     @ingroup Allocators
+     @brief Allocators implementation which simply calls malloc/free
+   */
   template <class T>
   class MallocAllocator {
   public:
-- 
GitLab