MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
alloc.hpp File Reference
#include <algorithm>
#include <unordered_map>
#include "mtcore/colls/result.hpp"
#include "mtcore/colls/slice.hpp"
#include "mtcore/core.hpp"
#include "mtcore/traits.hpp"
Include dependency graph for core/mtcore/alloc.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mtcore::Allocator
 Represents a memory allocator Exact behavior depends on the underlying VTable used Should use the a_* methods for working with an allocator. More...
 
struct  mtcore::Allocator::VTable
 V-Table for implementing your own allocator Each allocator has state, some of which is standardized (e.g. More...
 
struct  mtcore::MallocAllocator
 State variable for malloc-based allocator. More...
 
struct  mtcore::ThreadLocalDebugAllocator
 State variable for thread local debug allocator Must live longer (and at the same memory address) than all allocators returned by allocator() More...
 
struct  mtcore::ThreadLocalFixedBufferAllocator
 State variable for thread local fixed buffer allocator Must live longer (and at the same memory address) than all allocators returned by allocator() More...
 
struct  mtcore::ThreadLocalFixedArenaAllocator
 State variable for thread local fixed arena allocator Must live longer (and at the same memory address) than all allocators returned by allocator() More...
 
struct  mtcore::ThreadLocalDynamicArenaAllocator
 State variable for thread local dynamic arena allocator Must live longer (and at the same memory address) than all allocators returned by allocator() More...
 

Namespaces

namespace  mtcore
 Core library for C++ with Zig-related functionality.
 

Macros

#define MTCORE_ALLOC_HPP
 

Enumerations

enum class  mtcore::AllocationError { mtcore::AllocationError::ALLOCATION_FAILED }
 Error indicating failed allocation. More...
 
enum class  mtcore::AllocatorError { mtcore::AllocatorError::MEMORY_LEAK_DETECTED }
 Error indicating allocator internal state failed (e.g. More...
 

Functions

MallocAllocator mtcore::malloc_alloc () noexcept
 Creates a memory allocator using the standard's malloc under the hood Does no memory tracking Ideal for production/release/high performance.
 
ThreadLocalDebugAllocator mtcore::debug_alloc_thread_local () noexcept
 NOT THREAD SAFE!
 
ThreadLocalFixedBufferAllocator mtcore::fixed_buff_thread_local (Slice< u8 > bytes) noexcept
 NOT THREAD SAFE!
 
ThreadLocalFixedArenaAllocator mtcore::fixed_arena_thread_local (Slice< u8 > bytes) noexcept
 NOT THREAD SAFE!
 
ThreadLocalDynamicArenaAllocator mtcore::dynamic_arena_thread_local (Allocator *root, size_t elementSizeHint, size_t elementCountHint) noexcept
 NOT THREAD SAFE!
 

Macro Definition Documentation

◆ MTCORE_ALLOC_HPP

#define MTCORE_ALLOC_HPP

Definition at line 32 of file core/mtcore/alloc.hpp.