11#ifndef INCGUARD_MGL_MEMORY_DEFAULT_ALLOCATOR_H_1651231444 
   12#define INCGUARD_MGL_MEMORY_DEFAULT_ALLOCATOR_H_1651231444 
   38        void *(*allocator)(
size_t size){
nullptr};    
 
   44        void *(*reallocator)(
void *buffer, 
size_t size){
nullptr};    
 
 
   59    AllocatorType 
GetType() const noexcept
 override 
 
   64    bool Initialize(
const Configuration &config) 
noexcept;
 
   68    [[nodiscard]] 
void *
Allocate(
size_t size) noexcept override;
 
   69    void Deallocate(
void *buffer) noexcept override;
 
   70    [[nodiscard]] 
void *
Reallocate(
void *buffer, 
size_t newSize) noexcept override;
 
   72    bool GetSizeInfo(
size_t &dest, uint32_t key, uint32_t arg) noexcept override;
 
   77    bool _isInitialized{
false};
 
   80    static constexpr size_t kFixedSizeAllocatorCount = 4;
 
   82    Configuration _config;
 
   83    std::array<FixedSizeAllocator, kFixedSizeAllocatorCount> _fixedSizeAllocatorArray;
 
   84    size_t _fixedSizeBlockMax{0};
 
   88#if !defined(MGL_MEMORY_DEBUG_ENABLE) 
   89    std::atomic<size_t> _systemUsedCount{0};
 
   90    std::atomic<size_t> _systemUsedSize{0};
 
 
メモリアロケータインターフェース
Definition mgl_memory_allocator.h:42
 
デフォルトのメモリアロケータ
Definition mgl_memory_default_allocator.h:26
 
AllocatorType GetType() const noexcept override
このアロケータを表す値を取得
Definition mgl_memory_default_allocator.h:59
 
static constexpr AllocatorType kAllocatorType
このアロケータを表す値
Definition mgl_memory_default_allocator.h:50
 
bool GetSizeInfo(size_t &dest, uint32_t key, uint32_t arg) noexcept override
サイズ情報を取得
Definition mgl_memory_default_allocator.cc:306
 
void Deallocate(void *buffer) noexcept override
デアロケート
Definition mgl_memory_default_allocator.cc:203
 
bool Initialize() noexcept override
初期化処理
Definition mgl_memory_default_allocator.cc:135
 
void * Allocate(size_t size) noexcept override
アロケート
Definition mgl_memory_default_allocator.cc:161
 
bool IsInitialized() const noexcept override
初期化状態を取得
Definition mgl_memory_default_allocator.cc:148
 
DefaultAllocator() noexcept
コンストラクタ
Definition mgl_memory_default_allocator.cc:35
 
void * Reallocate(void *buffer, size_t newSize) noexcept override
リアロケート
Definition mgl_memory_default_allocator.cc:239
 
固定サイズアロケータクラス
Definition mgl_memory_fixed_size_allocator.h:21
 
デフォルトアロケータの設定
Definition mgl_memory_default_allocator.h:30
 
size_t fixedSizeAllocatorMinimumBlockSize
固定サイズアロケータの最小サイズ(2のn乗の値である必要がある)
Definition mgl_memory_default_allocator.h:32
 
void(* deallocator)(void *buffer)
外部デアロケータの指定(nullptr で free()を使用)
Definition mgl_memory_default_allocator.h:41
 
size_t fixedSizeAllocatorMemoryPoolSize
固定サイズアロケータのメモリプールのサイズ(最小サイズの8倍より大きくなければならない)
Definition mgl_memory_default_allocator.h:35