Lumiera  0.pre.03
»edit your freedom«
tracking-allocator.cpp File Reference

Go to the source code of this file.

Description

Implementation of the common storage backend for the tracking test allocator.

  • PoolRegistry maintains a common hashtable with all MemoryPool instances; when using the standard accessors, registration and pool creating happens automatically.
  • in this setup, the pool with ID="GLOBAL" is just one further pool, which will be established when a front-end function is used with the default pool-ID (i.e. without explicit pool specification). Note however, that such a factory is still statefull (since it embeds a shared-ownership smart-pointer)
  • each MemoryPool contains a hashtable, where each active allocation is stored, using the storage-location as hashtable key. Each such entry gets a further consecutive internal ID, which is visible in the EventLog
    See also
    tracking-allocator.hpp
    TestTracking_test::demonstrate_checkAllocator()

Definition in file tracking-allocator.cpp.

#include "lib/test/tracking-allocator.hpp"
#include "lib/uninitialised-storage.hpp"
#include "lib/iter-explorer.hpp"
#include "lib/depend.hpp"
#include "lib/util.hpp"
#include <string>
#include <unordered_map>

Classes

struct  MemoryPool::Allocation
 registration entry to maintain a single allocation More...
 
struct  MemoryPool::LocationHash
 
class  MemoryPool
 
class  PoolRegistry
 keep track of any distinct memory pools used More...
 

Functions

EventLog & log ()
 
template<typename... XS>
void logAlarm (XS const &...xs)
 
template<typename... ARGS>
void logAlloc (Literal pool, string fun, ARGS const &...args)
 

Variables

Depend< MemoryPool > globalPool
 singleton for default pool
 
Depend< PoolRegistry > poolReg
 

Namespaces

 lib
 Implementation namespace for support and library code.