CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Allocator.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8// The MIT License (MIT)
9//
10// Copyright (c) 2015 Howard Hinnant
11//
12// Permission is hereby granted, free of charge, to any person obtaining a copy
13// of this software and associated documentation files (the "Software"), to deal
14// in the Software without restriction, including without limitation the rights
15// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16// copies of the Software, and to permit persons to whom the Software is
17// furnished to do so, subject to the following conditions:
18//
19// The above copyright notice and this permission notice shall be included in all
20// copies or substantial portions of the Software.
21//
22// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28// SOFTWARE.
29
30#pragma once
31
33
34#include <cassert>
35#include <cstddef>
36#include <cstdint>
37#include <foonathan/memory/aligned_allocator.hpp>
38#include <foonathan/memory/deleter.hpp>
39#include <foonathan/memory/fallback_allocator.hpp>
40#include <foonathan/memory/iteration_allocator.hpp>
41#include <foonathan/memory/joint_allocator.hpp>
42#include <foonathan/memory/memory_arena.hpp>
43#include <foonathan/memory/memory_pool.hpp>
44#include <foonathan/memory/memory_pool_collection.hpp>
45#include <foonathan/memory/memory_resource_adapter.hpp>
46#include <foonathan/memory/segregator.hpp>
47#include <foonathan/memory/static_allocator.hpp>
48#include <foonathan/memory/std_allocator.hpp>
49#include <foonathan/memory/temporary_allocator.hpp>
50#include <foonathan/memory/tracking.hpp>
51#include <memory>
52#include <scoped_allocator>
53
54namespace CeresEngine {
55
57 using MemoryBlock = foonathan::memory::memory_block;
58
60 template<typename Allocator> using AllocatorTraits = foonathan::memory::allocator_traits<Allocator>;
61
63 template<typename Allocator> using ComposableAllocatorTraits = foonathan::memory::composable_allocator_traits<Allocator>;
64
67 using is_stateful = std::integral_constant<bool, false>; // NOLINT
68
69 [[nodiscard]] static void* allocate_node(std::size_t size, std::size_t alignment); // NOLINT
70 static void deallocate_node(void* node, std::size_t size, // NOLINT
71 std::size_t alignment) noexcept;
72
73 [[nodiscard]] static void* allocate_array(std::size_t count, std::size_t size, // NOLINT
74 std::size_t alignment);
75 static void deallocate_array(void* ptr, std::size_t count, std::size_t size, // NOLINT
76 std::size_t alignment) noexcept;
77
78 [[nodiscard]] static std::size_t max_node_size(); // NOLINT
79 [[nodiscard]] static std::size_t max_array_size(); // NOLINT
80 [[nodiscard]] static std::size_t max_alignment(); // NOLINT
81 };
82
83 template<class StoragePolicy, class Mutex> using AllocatorStorage = foonathan::memory::allocator_storage<StoragePolicy, Mutex>;
84
86 template<class RawAllocator> using DirectStorage = foonathan::memory::direct_storage<RawAllocator>;
87
89 template<class RawAllocator> using ReferenceStorage = foonathan::memory::reference_storage<RawAllocator>;
90
92 template<class RawAllocator> using AllocatorReference = foonathan::memory::allocator_reference<RawAllocator>;
93
95 using AnyAllocator = foonathan::memory::any_allocator;
96
98 using AnyAllocatorReference = foonathan::memory::any_allocator_reference;
99
101 template<class RawAllocator> using AllocatorAdapter = foonathan::memory::allocator_adapter<RawAllocator>;
102
104 template<class RawAllocator, class Mutex = std::mutex> using ThreadSafeAllocator = foonathan::memory::thread_safe_allocator<RawAllocator, Mutex>;
105
107 template<class RawAllocator> using AlignedAllocator = foonathan::memory::aligned_allocator<RawAllocator>;
108
110 using TemporaryAllocator = foonathan::memory::temporary_allocator;
111
113 using TemporaryStackInitializer = foonathan::memory::temporary_stack_initializer;
114
116 template<class Default, class Fallback> using FallbackAllocator = foonathan::memory::fallback_allocator<Default, Fallback>;
117
119 using HeapAllocator = foonathan::memory::heap_allocator;
120
122 template<std::size_t N, class BlockOrRawAllocator = DefaultAllocator>
123 using IterationAllocator = foonathan::memory::iteration_allocator<N, BlockOrRawAllocator>;
124
126 template<class BlockOrRawAllocator = DefaultAllocator> using DoubleFrameAllocator = foonathan::memory::double_frame_allocator<BlockOrRawAllocator>;
127
129 using MallocAllocator = foonathan::memory::malloc_allocator;
130
132 template<class BlockAllocator = DefaultAllocator, bool Cached = true> using MemoryArena = foonathan::memory::memory_arena<BlockAllocator, Cached>;
133
135 template<class RawAllocator = DefaultAllocator, unsigned Num = 2, unsigned Den = 1>
136 using GrowingBlockAllocator = foonathan::memory::growing_block_allocator<RawAllocator, Num, Den>;
137
139 template<class RawAllocator = DefaultAllocator> using FixedBlockAllocator = foonathan::memory::fixed_block_allocator<RawAllocator>;
140
142 using NodePool = foonathan::memory::node_pool;
143
145 using ArrayPool = foonathan::memory::array_pool;
146
148 using SmallNodePool = foonathan::memory::small_node_pool;
149
151 template<typename PoolType = foonathan::memory::node_pool, class BlockOrRawAllocator = DefaultAllocator>
152 using MemoryPool = foonathan::memory::memory_pool<PoolType, BlockOrRawAllocator>;
153
154 namespace BucketDistribution {
156 using IdentityBuckets = foonathan::memory::identity_buckets;
157
159 using Log2Buckets = foonathan::memory::log2_buckets;
160 } // namespace BucketDistribution
161
163 template<class PoolType, class BucketDistribution, class BlockOrRawAllocator = DefaultAllocator>
164 using MemoryPoolCollection = foonathan::memory::memory_pool_collection<PoolType, BucketDistribution, BlockOrRawAllocator>;
165
167 template<class PoolType = NodePool, class BlockOrRawAllocator = DefaultAllocator>
168 using BucketAllocator = foonathan::memory::bucket_allocator<PoolType, BlockOrRawAllocator>;
169
171 template<class BlockOrRawAllocator = DefaultAllocator> using MemoryStack = foonathan::memory::memory_stack<BlockOrRawAllocator>;
172
174 template<class Stack = MemoryStack<>> using MemoryStackScope = foonathan::memory::memory_stack_raii_unwind<Stack>;
175
177 using NewAllocator = foonathan::memory::new_allocator;
178
180 template<class RawAllocator> using ThresholdSegregatable = foonathan::memory::threshold_segregatable<RawAllocator>;
181
183 using NullAllocator = foonathan::memory::null_allocator;
184
186 template<class Segregatable, class RawAllocator> using BinarySegregator = foonathan::memory::binary_segregator<Segregatable, RawAllocator>;
187
189 template<std::size_t Size> using StaticAllocatorStorage = foonathan::memory::static_allocator_storage<Size>;
190
192 using StaticAllocator = foonathan::memory::static_allocator;
193
195 using StaticBlockAllocator = foonathan::memory::static_block_allocator;
196
198 template<class Tracker, class RawAllocator> using TrackedAllocator = foonathan::memory::tracked_allocator<Tracker, RawAllocator>;
199
201 template<class Tracker, class BlockOrRawAllocator> using TrackedBlockAllocator = foonathan::memory::tracked_block_allocator<Tracker, BlockOrRawAllocator>;
202
204 template<class Tracker, class BlockOrRawAllocator>
205 using DeeplyTrackedBlockAllocator = foonathan::memory::deeply_tracked_block_allocator<Tracker, BlockOrRawAllocator>;
206
208 using VirtualMemoryAllocator = foonathan::memory::virtual_memory_allocator;
209
211 using VirtualBlockAllocator = foonathan::memory::virtual_block_allocator;
212
214 template<typename T, class RawAllocator> using JointPtr = foonathan::memory::joint_ptr<T, RawAllocator>;
215
217 template<typename T> using JointArray = foonathan::memory::joint_array<T>;
218
220 template<typename T, class RawAllocator> using JointAllocator = foonathan::memory::joint_allocator;
221
222 // ---------------------------------------------------------------------------------------------
223
225 template<typename T, class RawAllocator = DefaultAllocator> using StdAllocator = foonathan::memory::std_allocator<T, RawAllocator>;
226
228 template<typename T> using AnyStdAllocator = foonathan::memory::any_std_allocator<T>;
229
231 template<class RawAllocator> using MemoryResourceAdapter = foonathan::memory::memory_resource_adapter<RawAllocator>;
232
234 using MemoryResourceAllocator = foonathan::memory::memory_resource_allocator;
235
237 template<typename Type, class RawAllocator> using AllocatorDeallocator = foonathan::memory::allocator_deallocator<Type, RawAllocator>;
238
240 template<typename BaseType, class RawAllocator>
241 using AllocatorPolymorphicDeallocator = foonathan::memory::allocator_polymorphic_deallocator<BaseType, RawAllocator>;
242
244 template<typename Type, class RawAllocator> using AllocatorDeleter = foonathan::memory::allocator_deleter<Type, RawAllocator>;
245
247 template<typename BaseType, class RawAllocator>
248 using AllocatorPolymorphicDeleter = foonathan::memory::allocator_polymorphic_deleter<BaseType, RawAllocator>;
249
250 // ---------------------------------------------------------------------------------------------
251
253
254 // ---------------------------------------------------------------------------------------------
255
257 using AllocatorInfo = foonathan::memory::allocator_info;
258
260 using OutOfMemoryError = foonathan::memory::out_of_memory;
261
263 using OutOfFixedMemoryError = foonathan::memory::out_of_fixed_memory;
264
266 using BadAllocationSizeError = foonathan::memory::bad_allocation_size;
267
269 using BadNodeSizeError = foonathan::memory::bad_node_size;
270
272 using BadArraySizeError = foonathan::memory::bad_array_size;
273
275 using BadAlignmentError = foonathan::memory::bad_alignment;
276
277 // ---------------------------------------------------------------------------------------------
278
279 using foonathan::memory::allocate_joint;
280 using foonathan::memory::clone_joint;
281 using foonathan::memory::get_temporary_stack;
282 using foonathan::memory::make_aligned_allocator;
283 using foonathan::memory::make_allocator_adapter;
284 using foonathan::memory::make_allocator_reference;
285 using foonathan::memory::make_any_allocator_reference;
286 using foonathan::memory::make_any_std_allocator;
287 using foonathan::memory::make_block_allocator;
288 using foonathan::memory::make_deeply_tracked_allocator;
289 using foonathan::memory::make_segregator;
290 using foonathan::memory::make_std_allocator;
291 using foonathan::memory::make_thread_safe_allocator;
292 using foonathan::memory::make_tracked_allocator;
293 using foonathan::memory::threshold;
294
295 // ---------------------------------------------------------------------------------------------
296
324 template<typename OuterAlloc, typename... InnerAlloc> using ScopedAllocatorAdaptor = std::scoped_allocator_adaptor<OuterAlloc, InnerAlloc...>;
325
326 // ---------------------------------------------------------------------------------------------
327
328 template<std::size_t N, std::size_t Alignment = alignof(std::max_align_t)> class Arena {
329 alignas(Alignment) char mBuffer[N];
330 char* mPointer;
331
332 public:
333 ~Arena() { mPointer = nullptr; }
335 Arena(const Arena&) = delete;
336 Arena& operator=(const Arena&) = delete;
337
338 template<std::size_t ReqAlign> char* allocate(std::size_t n);
339 void deallocate(char* p, std::size_t n) noexcept;
340
341 static constexpr std::size_t size() noexcept { return N; }
342 std::size_t used() const noexcept { return static_cast<std::size_t>(mPointer - mBuffer); }
344
345 private:
346 static std::size_t align_up(const std::size_t n) noexcept { return (n + (Alignment - 1)) & ~(Alignment - 1); }
347 bool pointer_in_buffer(char* p) noexcept { return std::uintptr_t(mBuffer) <= std::uintptr_t(p) && std::uintptr_t(p) <= std::uintptr_t(mBuffer) + N; }
348 };
349
350 template<std::size_t N, std::size_t Alignment> template<std::size_t ReqAlign> char* Arena<N, Alignment>::allocate(const std::size_t n) {
351 static_assert(ReqAlign <= Alignment, "alignment is too small for this arena");
352 assert(pointer_in_buffer(mPointer) && "short_alloc has outlived arena");
353 auto const aligned_n = align_up(n);
354 if(static_cast<decltype(aligned_n)>(mBuffer + N - mPointer) >= aligned_n) {
355 char* r = mPointer;
356 mPointer += aligned_n;
357 return r;
358 }
359
360 static_assert(Alignment <= alignof(std::max_align_t),
361 "you've chosen an "
362 "alignment that is larger than alignof(std::max_align_t), and "
363 "cannot be guaranteed by normal operator new");
364 return static_cast<char*>(::operator new(n));
365 }
366
367 template<std::size_t N, std::size_t Alignment> void Arena<N, Alignment>::deallocate(char* p, std::size_t n) noexcept {
368 assert(pointer_in_buffer(mPointer) && "short_alloc has outlived arena");
369 if(pointer_in_buffer(p)) {
370 n = align_up(n);
371 if(p + n == mPointer) {
372 mPointer = p;
373 }
374 } else {
375 ::operator delete(p);
376 }
377 }
378
379 template<class T, std::size_t N, std::size_t Align = alignof(std::max_align_t)> class ShortAllocator {
380 public:
381 static auto constexpr alignment = Align;
382 static auto constexpr size = N;
383
384 using ValueType = T;
385 using ArenaType = Arena<size * sizeof(T), alignment>;
386
388
389 private:
391
392 public:
395
396 ShortAllocator(ArenaType& a) noexcept : mArena(a) { static_assert(size % alignment == 0, "size N needs to be a multiple of alignment Align"); }
397 template<class U> ShortAllocator(const ShortAllocator<U, N, alignment>& a) noexcept : mArena(a.mArena) {}
398
399 template<class Up> struct rebind { using other = ShortAllocator<Up, N, alignment>; };
400
401 [[nodiscard]] T* allocate(const std::size_t n) { return reinterpret_cast<T*>(mArena.template allocate<alignof(T)>(n * sizeof(T))); }
402 void deallocate(T* p, const std::size_t n) noexcept { mArena.deallocate(reinterpret_cast<char*>(p), n * sizeof(T)); }
403
404 template<class T1, std::size_t N1, std::size_t A1, class U, std::size_t M, std::size_t A2>
405 friend bool operator==(const ShortAllocator<T1, N1, A1>& x, const ShortAllocator<U, M, A2>& y) noexcept;
406
407 template<class U, std::size_t M, std::size_t A> friend class ShortAllocator;
408 };
409
410 template<class T, std::size_t N, std::size_t A1, class U, std::size_t M, std::size_t A2>
411 inline bool operator==(const ShortAllocator<T, N, A1>& x, const ShortAllocator<U, M, A2>& y) noexcept {
412 return N == M && A1 == A2 && &x.mArena == &y.mArena;
413 }
414
415 template<class T, std::size_t N, std::size_t A1, class U, std::size_t M, std::size_t A2>
416 inline bool operator!=(const ShortAllocator<T, N, A1>& x, const ShortAllocator<U, M, A2>& y) noexcept {
417 return !(x == y);
418 }
419
420} // namespace CeresEngine
421
422[[nodiscard]] void* operator new(std::size_t count, std::align_val_t alignment);
423[[nodiscard]] void* operator new(std::size_t count);
424[[nodiscard]] void* operator new(std::size_t count, std::align_val_t alignment, const std::nothrow_t&) noexcept;
425[[nodiscard]] void* operator new(std::size_t count, const std::nothrow_t&) noexcept;
426
427[[nodiscard]] void* operator new[](std::size_t count, std::align_val_t alignment);
428[[nodiscard]] void* operator new[](std::size_t count);
429[[nodiscard]] void* operator new[](std::size_t count, std::align_val_t alignment, const std::nothrow_t&) noexcept;
430[[nodiscard]] void* operator new[](std::size_t count, const std::nothrow_t&) noexcept;
431
432void operator delete(void* ptr, std::align_val_t alignment) noexcept;
433void operator delete(void* ptr) noexcept;
434void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
435void operator delete(void* ptr, const std::nothrow_t&) noexcept;
436
437void operator delete(void* ptr, std::size_t sz, std::align_val_t alignment) noexcept;
438void operator delete(void* ptr, std::size_t sz) noexcept;
439void operator delete(void* ptr, std::size_t sz, std::align_val_t alignment, const std::nothrow_t&) noexcept;
440void operator delete(void* ptr, std::size_t sz, const std::nothrow_t&) noexcept;
441
442void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
443void operator delete[](void* ptr) noexcept;
444void operator delete[](void* ptr, const std::nothrow_t& tag) noexcept;
445void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
446
447void operator delete[](void* ptr, std::size_t sz, std::align_val_t alignment) noexcept;
448void operator delete[](void* ptr, std::size_t sz) noexcept;
449void operator delete[](void* ptr, std::size_t sz, const std::nothrow_t& tag) noexcept;
450void operator delete[](void* ptr, std::size_t sz, std::align_val_t alignment, const std::nothrow_t&) noexcept;
451
452template<> class foonathan::memory::allocator_traits<CeresEngine::DefaultAllocator> {
453public:
454 using allocator_type = CeresEngine::DefaultAllocator;
455 using is_stateful = std::integral_constant<bool, false>;
456
457 static void* allocate_node(allocator_type& state, const std::size_t size, const std::size_t alignment) { return state.allocate_node(size, alignment); }
458 static void deallocate_node(allocator_type& state, void* node, const std::size_t size, const std::size_t alignment) noexcept {
459 state.deallocate_node(node, size, alignment);
460 }
461
462 static void* allocate_array(allocator_type& state, const std::size_t count, const std::size_t size, const std::size_t alignment) {
463 return state.allocate_array(count, size, alignment);
464 }
465 static void deallocate_array(allocator_type& state, void* array, const std::size_t count, const std::size_t size, const std::size_t alignment) noexcept {
466 state.deallocate_array(array, count, size, alignment);
467 }
468
469 static std::size_t max_node_size(const allocator_type& state) { return state.max_node_size(); }
470 static std::size_t max_array_size(const allocator_type& state) { return state.max_array_size(); }
471 static std::size_t max_alignment(const allocator_type& state) { return state.max_alignment(); }
472};
#define CE_EXPORT
The CE_EXPORT macro marks a symbol as exported in a DLL.
Definition Macros.hpp:229
Definition Allocator.hpp:328
Arena() noexcept
Definition Allocator.hpp:334
std::size_t used() const noexcept
Definition Allocator.hpp:342
static constexpr std::size_t size() noexcept
Definition Allocator.hpp:341
char mBuffer[N]
Definition Allocator.hpp:329
char * allocate(std::size_t n)
Definition Allocator.hpp:350
void reset() noexcept
Definition Allocator.hpp:343
Arena(const Arena &)=delete
~Arena()
Definition Allocator.hpp:333
static std::size_t align_up(const std::size_t n) noexcept
Definition Allocator.hpp:346
char * mPointer
Definition Allocator.hpp:330
Arena & operator=(const Arena &)=delete
void deallocate(char *p, std::size_t n) noexcept
Definition Allocator.hpp:367
bool pointer_in_buffer(char *p) noexcept
Definition Allocator.hpp:347
Definition Allocator.hpp:379
ShortAllocator(ArenaType &a) noexcept
Definition Allocator.hpp:396
ShortAllocator & operator=(const ShortAllocator &)=delete
friend bool operator==(const ShortAllocator< T1, N1, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
T ValueType
Definition Allocator.hpp:384
ValueType value_type
Definition Allocator.hpp:387
static auto constexpr size
Definition Allocator.hpp:382
void deallocate(T *p, const std::size_t n) noexcept
Definition Allocator.hpp:402
ShortAllocator(const ShortAllocator< U, N, alignment > &a) noexcept
Definition Allocator.hpp:397
ArenaType mArena
Definition Allocator.hpp:390
ShortAllocator(const ShortAllocator &)=default
static auto constexpr alignment
Definition Allocator.hpp:381
T * allocate(const std::size_t n)
Definition Allocator.hpp:401
foonathan::memory::identity_buckets IdentityBuckets
Definition Allocator.hpp:156
foonathan::memory::log2_buckets Log2Buckets
Definition Allocator.hpp:159
Definition Application.hpp:19
foonathan::memory::static_block_allocator StaticBlockAllocator
Definition Allocator.hpp:195
foonathan::memory::bucket_allocator< PoolType, BlockOrRawAllocator > BucketAllocator
Definition Allocator.hpp:168
foonathan::memory::composable_allocator_traits< Allocator > ComposableAllocatorTraits
Definition Allocator.hpp:63
foonathan::memory::node_pool NodePool
Definition Allocator.hpp:142
foonathan::memory::bad_array_size BadArraySizeError
Definition Allocator.hpp:272
foonathan::memory::tracked_allocator< Tracker, RawAllocator > TrackedAllocator
Definition Allocator.hpp:198
foonathan::memory::allocator_adapter< RawAllocator > AllocatorAdapter
Definition Allocator.hpp:101
foonathan::memory::allocator_polymorphic_deallocator< BaseType, RawAllocator > AllocatorPolymorphicDeallocator
Definition Allocator.hpp:241
foonathan::memory::bad_alignment BadAlignmentError
Definition Allocator.hpp:275
foonathan::memory::allocator_traits< Allocator > AllocatorTraits
Definition Allocator.hpp:60
foonathan::memory::tracked_block_allocator< Tracker, BlockOrRawAllocator > TrackedBlockAllocator
Definition Allocator.hpp:201
foonathan::memory::out_of_fixed_memory OutOfFixedMemoryError
Definition Allocator.hpp:263
foonathan::memory::small_node_pool SmallNodePool
Definition Allocator.hpp:148
foonathan::memory::any_allocator_reference AnyAllocatorReference
Definition Allocator.hpp:98
foonathan::memory::std_allocator< T, RawAllocator > StdAllocator
Definition Allocator.hpp:225
foonathan::memory::allocator_storage< StoragePolicy, Mutex > AllocatorStorage
Definition Allocator.hpp:83
foonathan::memory::memory_block MemoryBlock
Definition Allocator.hpp:57
foonathan::memory::allocator_deleter< Type, RawAllocator > AllocatorDeleter
Definition Allocator.hpp:244
foonathan::memory::temporary_allocator TemporaryAllocator
Definition Allocator.hpp:110
foonathan::memory::memory_arena< BlockAllocator, Cached > MemoryArena
Definition Allocator.hpp:132
bool operator!=(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:416
foonathan::memory::any_std_allocator< T > AnyStdAllocator
Definition Allocator.hpp:228
foonathan::memory::array_pool ArrayPool
Definition Allocator.hpp:145
foonathan::memory::growing_block_allocator< RawAllocator, Num, Den > GrowingBlockAllocator
Definition Allocator.hpp:136
foonathan::memory::iteration_allocator< N, BlockOrRawAllocator > IterationAllocator
Definition Allocator.hpp:123
foonathan::memory::bad_node_size BadNodeSizeError
Definition Allocator.hpp:269
foonathan::memory::heap_allocator HeapAllocator
Definition Allocator.hpp:119
foonathan::memory::virtual_memory_allocator VirtualMemoryAllocator
Definition Allocator.hpp:208
foonathan::memory::memory_resource_adapter< RawAllocator > MemoryResourceAdapter
Definition Allocator.hpp:231
foonathan::memory::allocator_info AllocatorInfo
Definition Allocator.hpp:257
foonathan::memory::binary_segregator< Segregatable, RawAllocator > BinarySegregator
Definition Allocator.hpp:186
foonathan::memory::malloc_allocator MallocAllocator
Definition Allocator.hpp:129
foonathan::memory::direct_storage< RawAllocator > DirectStorage
Definition Allocator.hpp:86
bool operator==(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:411
DefaultAllocator & gDefaultAllocator()
foonathan::memory::static_allocator_storage< Size > StaticAllocatorStorage
Definition Allocator.hpp:189
foonathan::memory::joint_allocator JointAllocator
Definition Allocator.hpp:220
foonathan::memory::memory_stack_raii_unwind< Stack > MemoryStackScope
Definition Allocator.hpp:174
foonathan::memory::deeply_tracked_block_allocator< Tracker, BlockOrRawAllocator > DeeplyTrackedBlockAllocator
Definition Allocator.hpp:205
foonathan::memory::allocator_polymorphic_deleter< BaseType, RawAllocator > AllocatorPolymorphicDeleter
Definition Allocator.hpp:248
foonathan::memory::joint_ptr< T, RawAllocator > JointPtr
Definition Allocator.hpp:214
foonathan::memory::reference_storage< RawAllocator > ReferenceStorage
Definition Allocator.hpp:89
foonathan::memory::memory_pool_collection< PoolType, BucketDistribution, BlockOrRawAllocator > MemoryPoolCollection
Definition Allocator.hpp:164
foonathan::memory::fixed_block_allocator< RawAllocator > FixedBlockAllocator
Definition Allocator.hpp:139
foonathan::memory::any_allocator AnyAllocator
Definition Allocator.hpp:95
foonathan::memory::joint_array< T > JointArray
Definition Allocator.hpp:217
foonathan::memory::memory_pool< PoolType, BlockOrRawAllocator > MemoryPool
Definition Allocator.hpp:152
foonathan::memory::allocator_deallocator< Type, RawAllocator > AllocatorDeallocator
Definition Allocator.hpp:237
foonathan::memory::threshold_segregatable< RawAllocator > ThresholdSegregatable
Definition Allocator.hpp:180
foonathan::memory::memory_stack< BlockOrRawAllocator > MemoryStack
Definition Allocator.hpp:171
foonathan::memory::null_allocator NullAllocator
Definition Allocator.hpp:183
foonathan::memory::double_frame_allocator< BlockOrRawAllocator > DoubleFrameAllocator
Definition Allocator.hpp:126
foonathan::memory::out_of_memory OutOfMemoryError
Definition Allocator.hpp:260
foonathan::memory::static_allocator StaticAllocator
Definition Allocator.hpp:192
foonathan::memory::fallback_allocator< Default, Fallback > FallbackAllocator
Definition Allocator.hpp:116
foonathan::memory::allocator_reference< RawAllocator > AllocatorReference
Definition Allocator.hpp:92
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
foonathan::memory::aligned_allocator< RawAllocator > AlignedAllocator
Definition Allocator.hpp:107
std::scoped_allocator_adaptor< OuterAlloc, InnerAlloc... > ScopedAllocatorAdaptor
The ScopedAllocatorAdaptor class template is an allocator which can be used with multilevel container...
Definition Allocator.hpp:324
foonathan::memory::temporary_stack_initializer TemporaryStackInitializer
Definition Allocator.hpp:113
foonathan::memory::new_allocator NewAllocator
Definition Allocator.hpp:177
foonathan::memory::thread_safe_allocator< RawAllocator, Mutex > ThreadSafeAllocator
Definition Allocator.hpp:104
foonathan::memory::virtual_block_allocator VirtualBlockAllocator
Definition Allocator.hpp:211
foonathan::memory::memory_resource_allocator MemoryResourceAllocator
Definition Allocator.hpp:234
foonathan::memory::bad_allocation_size BadAllocationSizeError
Definition Allocator.hpp:266
Definition Allocator.hpp:66
static std::size_t max_node_size()
static std::size_t max_array_size()
static void * allocate_node(std::size_t size, std::size_t alignment)
std::integral_constant< bool, false > is_stateful
Definition Allocator.hpp:67
static void * allocate_array(std::size_t count, std::size_t size, std::size_t alignment)
static void deallocate_node(void *node, std::size_t size, std::size_t alignment) noexcept
static void deallocate_array(void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept
static std::size_t max_alignment()
Definition Allocator.hpp:399