This ALib Module implements the concept of "monotonic allocation" by providing central class MonoAllocator and a few corresponding container and utility types.
Please consult ALib Module Memory - Programmer's Manual for further information.
Nested Namespaces: | |
namespace | detail |
namespace | util |
Type Index: | |
class | HashTable |
class | List |
class | MonoAllocator |
struct | Recycling |
class | SelfContained |
struct | StdContMA |
struct | StdContMAOptional |
struct | StdContMARecycling |
class | StringTree |
struct | StringTreeNamesDynamic |
struct | StringTreeNamesMonoAlloc |
struct | StringTreeNamesStatic |
class | TMAString |
Type Definition Index: | |
template<typename TKey , typename TMapped , typename THash = std::hash <TKey>, typename TEqual = std::equal_to<TKey>, lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private> | |
using | HashMap |
template<typename T , typename THash = std::hash <T>, typename TEqual = std::equal_to<T>, lang::Caching THashCaching = lang::Caching::Auto, typename TRecycling = Recycling::Private> | |
using | HashSet |
Function Index: | |
MonoAllocator & | AcquireGlobalAllocator (const NCString &dbgFile, int dbgLine, const NCString &dbgFunc) |
template<typename THashtable > | |
AString | DbgDumpDistribution (const THashtable &hashtable, bool detailedBucketList) |
template<typename THashtable > | |
AString | DbgDumpHashtable (const THashtable &hashtable) |
template<typename THashtable > | |
std::tuple< double, double, integer, integer > | DbgGetHashTableDistribution (const THashtable &hashtable) |
template<typename T > | |
static ALIB_FORCE_INLINE void | Destruct (T *object) |
void | ReleaseGlobalAllocator () |
Variable Index: | |
ALIB_API uinteger | DbgStatsStringTreeNameOverflows = 0 |
ALIB_API uinteger | DbgStatsStringTreeNames = 0 |
MonoAllocator | GlobalAllocator (8 *1024) |
ALIB_API ThreadLock | GlobalAllocatorLock |
using HashMap |
This type definition is a shortcut to HashTable , usable if the data stored in the container consists of two parts, a key and a mapped part, where only the key-part is to be used for the comparison of values.
TKey | The type of the key-portion of the inserted data. This type is published as HashTable::KeyType . |
TMapped | The type of the mapped-portion of the inserted data. This type is published as HashTable::MappedType . |
THash | The hash functor applicable to TKey . Defaults to std::hash<TKey> and is published as HashTable::HashType . |
TEqual | The comparison functor on TKey . Defaults to std::equal_to<TKey> and is published as HashTable::EqualType . |
THashCaching | Determines if hash codes are cached when elements are inserted. Defaults to Caching::Auto, which enables caching if std::is_arithmetic<TKey>::value evaluates to false . |
TRecycling | Denotes the type of recycling that is to be performed. Possible values are Recycling::Private (the default), Recycling::Shared or Recycling::None . |
Definition at line 86 of file hashmap.hpp.
using HashSet |
This type definition is a shortcut to HashTable , usable if the full portion of the data stored in the container is used for the comparison of values.
T | The element type stored with this container. This type is published as HashTable::ValueType and type definition HashTable::KeyType becomes a synonym. |
THash | The hash functor applicable to TKey . Defaults to std::hash<TKey> and is published as HashTable::HashType . |
TEqual | The comparison functor on TKey . Defaults to std::equal_to<TKey> and is published as HashTable::EqualType . |
THashCaching | Determines if hash codes are cached when elements are inserted. Defaults to Caching::Auto, which enables caching if std::is_arithmetic<T>::value evaluates to false . |
TRecycling | Denotes the type of recycling that is to be performed. Possible values are Recycling::Private (the default), Recycling::Shared or Recycling::None . |
Definition at line 76 of file hashset.hpp.
|
inline |
Simple inline function that acquires GlobalAllocatorLock and returns the object singleton GlobalAllocator .
dbgFile | Caller information. Available only with debug builds and if ALib Threads is included in the ALib Distribution . |
dbgLine | Caller information. Available only with debug builds and if ALib Threads is included in the ALib Distribution . |
dbgFunc | Caller information. Available only with debug builds and if ALib Threads is included in the ALib Distribution . |
|
inline |
Invokes method DbgGetHashTableDistribution and creates human readable output, ready to be logged or written to the console.
THashtable | A specification of templated type HashTable . Deduced by the compiler by given parameter hashtable . |
hashtable | The hashtable to investigate on. |
detailedBucketList | If true is given, for each bucket a line with its size value and a "size bar" is written. |
Definition at line 2460 of file hashtable.hpp.
|
inline |
Dumps all values of the hash table sorted by buckets. Besides other scenarios of usage, this method allows to investigate into how the keys of the table are distributed in the buckets, and thus learn something about the hash algorithm used.
Prior to invoking this method, specializations of T_Append have to be made and furthermore, boxed values of the type have to be "made appendable" to instances of type AString. The latter is rather simple, if done using this macro during bootstrap.
THashtable | A specification of templated type HashTable . Deduced by the compiler by given parameter hashtable . |
hashtable | The hashtable to investigate on. |
Definition at line 2548 of file hashtable.hpp.
|
inline |
Generates statistics on the given hash table. The meanings of the returned tuple are: 0. The expected average size of a bucket (simply table size divided by number of buckets).
1.0
denotes the gaussian distribution which indicates perfect randomness. However, this value is unlikely (impossible) to be achieved.THashtable | A specification of templated type HashTable . Deduced by the compiler by given parameter hashtable . |
hashtable | The hashtable to investigate on. |
Definition at line 2403 of file hashtable.hpp.
|
static |
This static inline namespace function calls the destructor ~T()of given object . The use of this method is recommended instead of calling the destructor directly, to increase readability of the code.
T | The object type. Deduced by the compiler and not needed to be given. |
object | The object to destruct. |
Definition at line 651 of file monoallocator.hpp.
|
inline |
Simple inline function that releases GlobalAllocatorLock , previously acquired with AcquireGlobalAllocator .
Statistic variable increased by StringTreeNamesDynamic with every creation of a node whose name exceeds the internal string buffer size. With process creation the variable is 0
. A user may reset the variable to inspect percentages of name overflows during certain operations. The variable is not thread safe and used by any instance of class StringTree which uses node maintainer StringTreeNamesDynamic.
Definition at line 92 of file monoallocator.cpp.
Statistic variable increased by StringTreeNamesDynamic with every creation of a node. With process creation the variable is 0
. A user may reset the variable to inspect percentages of name overflows during certain operations. The variable is not thread safe and used by any instance of class StringTree which uses node maintainer StringTreeNamesDynamic.
Definition at line 91 of file monoallocator.cpp.
ALIB_API MonoAllocator GlobalAllocator | ( | 8 * | 1024 | ) |
This is the global monotonic allocator singleton instance.
Definition at line 702 of file monoallocator.hpp.
|
extern |
This mutex is used by methods AcquireGlobalAllocator and ReleaseGlobalAllocator to control access over the global allocator instance GlobalAllocator .
This object may be controlled directly as an alternative to using the functions named above, for example in combination with macro ALIB_LOCK_WITH, with attaches the locking/unlocking mechanisms "automatically" to the current call stack.