Template Class GridBlockAllocator

Nested Relationships

Nested Types

Class Documentation

template<typename DataT>
class GridBlockAllocator

The GridBlockAllocator is used to pre-allocate the meory of multiple Grids in “chunks”. It is a very simple memory pool.

Each chunk allocates memory for 512 Grids

Public Types

using Deleter = std::function<void()>

Public Functions

inline GridBlockAllocator(size_t log2dim)
GridBlockAllocator(const GridBlockAllocator&) = delete
GridBlockAllocator(GridBlockAllocator&&) = default
GridBlockAllocator &operator=(const GridBlockAllocator &other) = delete
GridBlockAllocator &operator=(GridBlockAllocator &&other) = default
inline std::pair<DataT*, Deleter> allocateBlock()
inline void clear()
inline void releaseUnusedMemory()
inline size_t capacity() const
inline size_t size() const
inline size_t memUsage() const

Public Static Attributes

static constexpr size_t blocks_per_chunk = 512

Protected Functions

inline void addNewChunk()
inline Deleter createDeleter(std::shared_ptr<Chunk> chunk, uint32_t index)

Protected Attributes

size_t log2dim_ = 0
size_t block_bytes_ = 0
size_t capacity_ = 0
size_t size_ = 0
std::vector<std::shared_ptr<Chunk>> chunks_
std::unique_ptr<std::mutex> mutex_
struct Chunk

Public Functions

inline Chunk()

Public Members

Mask mask
std::vector<char> data