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

Go to the source code of this file.

Classes

struct  mtcore::thread::DynamicArenaAllocator
 Allocator state object for shared dynamic arena allocation Must live longer (and at the same memory address) than all allocators returned by allocator() More...
 
struct  mtcore::thread::FixedArenaAllocator
 Allocator state object for shared fixed arena allocation Must live longer (and at the same memory address) than all allocators returned by allocator() More...
 
struct  mtcore::thread::FixedBufferAllocator
 Allocator state object for shared fixed buffer allocation Must live longer (and at the same memory address) than all allocators returned by allocator() More...
 
struct  mtcore::thread::DebugAllocator
 Allocator state object for shared debug allocation 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.
 
namespace  mtcore::thread
 Thread-related namespace The methods and classes provided by this class are thread-safe Classes and methods provided outside of this class are not thread-safe (with the exception of malloc_alloc) This requires linking mtcore_thread to your application.
 

Macros

#define MTCORE_THREAD_ALLOC_HPP
 

Functions

DynamicArenaAllocator mtcore::thread::dynamic_arena (Allocator *root, size_t elementSizeHint, size_t elementCountHint) noexcept
 Creates a dynamically growing arena allocator This arena allocator will grow if it runs out of space The allocator will clean all pages on deinit, and reallocate them again when the next allocation happens It does iterate through all pages, so it's \(O(p)\) to allocate Use maxElementHint (max element size) and maxCountHint (max number of elements per page) to hint at page size.
 
FixedArenaAllocator mtcore::thread::fixed_arena (Slice< u8 > bytes) noexcept
 Creates basic arena allocator which just pushes more state onto the end Calling deinit will simply reset the stack pointer.
 
FixedBufferAllocator mtcore::thread::fixed_buff (Slice< u8 > bytes) noexcept
 Creates an allocator that works on a fixed buffer of bytes.
 
DebugAllocator mtcore::thread::debug_alloc () noexcept
 Creates a memory allocator using the standard's malloc under the hood This allocator will do basic tracking of memory allocations Once all instances of std_alloc are de-initialized, it will then check to see if any memory is being leakd.
 

Macro Definition Documentation

◆ MTCORE_THREAD_ALLOC_HPP

#define MTCORE_THREAD_ALLOC_HPP

Definition at line 22 of file thread/mtcore_thread/alloc.hpp.