OROCHI
 
Loading...
Searching...
No Matches
GxAllocatorHeap Class Reference

ヒープメモリアロケータ More...

#include <GxAllocatorHeap.h>

Inheritance diagram for GxAllocatorHeap:
Collaboration diagram for GxAllocatorHeap:

Classes

struct  GxHeapInformation
 ヒープ情報ヘッダー (BLOCK_SIZEアライメント) More...
 

定義

enum class  ALLOCATE_TYPE { FAST = 0 , HEAD , TAIL , MAX }
 メモリ確保手法 More...
 

初期化

 GxAllocatorHeap (void)
 デフォルトコンストラクタ (使用禁止)
 
 GxAllocatorHeap (GX_CSTR name)
 コンストラクタ (クラス内部用)
 
void initialize (void *pAddress, u32 size)
 初期化
 
 GxAllocatorHeap (GX_CSTR name, GxMemory::TYPE type, u32 size)
 コンストラクタ
 
 GxAllocatorHeap (GX_CSTR name, void *pAddress, u32 size)
 コンストラクタ (確保メモリ割り付けタイプ)
 
 ~GxAllocatorHeap (void)
 デストラクタ
 
static GxAllocatorHeapcreate (GX_CSTR name, void *pAddress, u32 size)
 メモリ指定生成
 
static void destroy (GxAllocatorHeap *&pAllocator)
 メモリ指定破棄
 

操作

void * allocateMemoryFast (u32 size, GxMemory::ALIGNMENT alignment)
 高速探索メモリ確保
 
void * allocateMemoryForward (u32 size, GxMemory::ALIGNMENT alignment)
 前方探索メモリ確保
 
void * allocateMemoryBack (u32 size, GxMemory::ALIGNMENT alignment)
 後方探索メモリ確保
 
void insertHeap (GxHeapInformation *pBaseHeap, GxHeapInformation *pInsertHeap)
 新規ヒープ情報の挿入
 
void linkFreeHeapList (GxHeapInformation *pFreeHeap)
 空き領域ヒープリストの連結
 
u32 getHashValue (u32 value) const
 ハッシュ値の取得
 
void calculateMaxAvailableSize (void)
 最大確保可能サイズの計算
 
void * allocateMemory (u32 type, u32 size, GxMemory::ALIGNMENT alignment=GxMemory::ALIGNMENT::_16) override
 メモリ確保
 
void freeMemory (void *pAddress) override
 メモリ解放
 
void * reallocMemory (void *pAddress, u32 size) override
 メモリ割り当てサイズ変更
 
b32 isValid (void)
 全体管理領域のチェック
 
b32 isValid (const GxHeapInformation *pHeapInformation) const
 指定管理領域のチェック
 

アクセサ

constexpr u32 getUsedSize (void) const
 使用サイズの取得
 
u32 getFreeMax (void) const
 最大空き容量取得
 
u32 getMaxAvailableSize (GxMemory::ALIGNMENT alignment=GxMemory::ALIGNMENT::_16) const
 最大確保可能サイズ取得
 
constexpr GxHeapInformationgetHeapTop (void) const
 ヒープ先頭アドレスの取得
 
static void * getMemoryPointer (const GxAllocatorHeap::GxHeapInformation *pHeapInformation)
 ヘッダーポインタから確保メモリを取得
 
static GxHeapInformationgetHeaderPointer (void *pAddress)
 確保メモリからヘッダーポインタ取得
 
static u32 getBlockFromSize (u32 size)
 サイズ → ブロック数取得
 
static u32 getSizeFromBlock (u32 block)
 ブロック数 → サイズ取得
 
static u32 getHeaderSize (void)
 ヘッダーサイズ取得 (※BLOCK_SIZEでのアライメント考慮)
 

Additional Inherited Members

- Public Types inherited from GxAllocator
enum  ATTRIBUTE {
  ATTRIBUTE_ZERO_CLEAR = (1 << 0) , ATTRIBUTE_THREAD_SAFE = (1 << 1) , ATTRIBUTE_SEQUENTIAL_THREAD_SAFE = (1 << 2) , ATTRIBUTE_TRACE = (1 << 3) ,
  ATTRIBUTE_LOCKED_TRACE = (1 << 4)
}
 属性 More...
 
- Public Member Functions inherited from GxAllocator
constexpr void * getAddress (void) const
 確保アドレス取得
 
constexpr u32 getSize (void) const
 確保サイズ取得
 
constexpr u32 getAttribute (void) const
 アトリビュート取得
 
constexpr void setAttribute (u32 attribute)
 アトリビュート設定
 
constexpr void addAttribute (u32 attribute)
 アトリビュート追加
 
constexpr GxMemory::TYPE getMemoryType (void) const
 メモリ確保タイプ取得
 
 ~GxAllocator (void) override
 デストラクタ
 
virtual b32 isValidAddr (const void *pAddress)
 メモリ範囲チェック
 
- Public Member Functions inherited from GxClassBase
constexpr GxClassBase (void)
 コンストラクタ
 
constexpr GxClassBase (const GxClassBase &base)
 コピーコンストラクタ
 
 ~GxClassBase (void) override
 デストラクタ
 
- Public Member Functions inherited from GxClassBaseRoot
constexpr GxClassBaseRoot (void)
 コンストラクタ
 
constexpr GxClassBaseRoot (const GxClassBaseRoot &)
 コピーコンストラクタ
 
virtual ~GxClassBaseRoot (void)
 デストラクタ
 
constexpr GxClassBaseRootoperator= (const GxClassBaseRoot &)
 代入演算子
 
virtual GxRttigetRtti (void) const =0
 Rttiの取得
 
virtual GX_FORCE_INLINE const GxTypedObjectgetDefaultObject (void)
 デフォルトオブジェクトを取得
 
GX_FORCE_INLINE b32 isDefaultObject (void)
 デフォルトオブジェクト判定
 
- Static Public Member Functions inherited from GxClassBaseRoot
static GX_FORCE_INLINE GxRtti__getStaticRtti (void)
 Rttiの取得
 
- Static Public Attributes inherited from GxAllocator
static constexpr u32 ALLOCATE_TYPE_DEFAULT = 0
 ディフォルト値
 
- Protected Member Functions inherited from GxAllocator
 GxAllocator (void)
 ディフォルトコンストラクタ
 
 GxAllocator (GxMemory::TYPE type, GX_CSTR name)
 コンストラクタ
 
void lock (void)
 スレッドロック
 
void unlock (void)
 スレッドアンロック
 
void initializeAllocateBuffer (void *pAddress, u32 size)
 確保メモリ初期化
 
void terminateAllocateBuffer (void *pAddress, u32 size)
 確保メモリ終了
 
- Protected Attributes inherited from GxAllocator
GxCriticalSection _criticalSection
 クリティカルセクション
 
void * _pAddress
 確保アドレス
 
u32 _size
 確保サイズ
 
u32 _attribute
 属性
 
GxMemory::TYPE _type
 メモリ確保タイプ
 

Detailed Description

ヒープメモリアロケータ

Member Enumeration Documentation

◆ ALLOCATE_TYPE

enum class GxAllocatorHeap::ALLOCATE_TYPE
strong

メモリ確保手法

Enumerator
FAST 

高速探索 (空き領域ハッシュ探索)

HEAD 

前方取得

TAIL 

後方取得

MAX 

メモリ確保手法数

Constructor & Destructor Documentation

◆ GxAllocatorHeap() [1/3]

GxAllocatorHeap::GxAllocatorHeap ( GX_CSTR name)
protected

コンストラクタ (クラス内部用)

Parameters
name[in] アロケータ名 (※開発時のみ有効)

◆ GxAllocatorHeap() [2/3]

GxAllocatorHeap::GxAllocatorHeap ( GX_CSTR name,
GxMemory::TYPE type,
u32 size )

コンストラクタ

Parameters
name[in] アロケータ名 (※開発時のみ有効)
type[in] メモリ確保タイプ
size[in] アロケータ割り当てサイズ
Here is the call graph for this function:

◆ GxAllocatorHeap() [3/3]

GxAllocatorHeap::GxAllocatorHeap ( GX_CSTR name,
void * pAddress,
u32 size )

コンストラクタ (確保メモリ割り付けタイプ)

Parameters
name[in] アロケータ名 (※開発時のみ有効)
pAddress[in] アロケータ割り当てメモリ
size[in] アロケータ割り当てサイズ
Here is the call graph for this function:

Member Function Documentation

◆ allocateMemory()

void * GxAllocatorHeap::allocateMemory ( u32 type,
u32 size,
GxMemory::ALIGNMENT alignment = GxMemory::ALIGNMENT::_16 )
overridevirtual

メモリ確保

Parameters
type[in] 確保タイプ (※ALLOCATE_TYPEを指定する)
size[in] 確保サイズ
filename[in] 呼び出し元ファイル名 (※DEBUG時のみ)
line[in] 呼び出し元ソースライン番号 (※DEBUG時のみ)
alignment[in] メモリアライメント
Returns
確保アドレス

Reimplemented from GxAllocator.

Here is the call graph for this function:

◆ allocateMemoryBack()

void * GxAllocatorHeap::allocateMemoryBack ( u32 size,
GxMemory::ALIGNMENT alignment )
protected

後方探索メモリ確保

Parameters
size[in] 確保サイズ
alignment[in] メモリアライメント
Returns
確保メモリアドレス
Here is the call graph for this function:

◆ allocateMemoryFast()

void * GxAllocatorHeap::allocateMemoryFast ( u32 size,
GxMemory::ALIGNMENT alignment )
protected

高速探索メモリ確保

Parameters
size[in] 確保サイズ
alignment[in] メモリアライメント
Returns
確保メモリアドレス
Here is the call graph for this function:

◆ allocateMemoryForward()

void * GxAllocatorHeap::allocateMemoryForward ( u32 size,
GxMemory::ALIGNMENT alignment )
protected

前方探索メモリ確保

Parameters
size[in] 確保サイズ
alignment[in] メモリアライメント
Returns
確保メモリアドレス
Here is the call graph for this function:

◆ create()

GxAllocatorHeap * GxAllocatorHeap::create ( GX_CSTR name,
void * pAddress,
u32 size )
static

メモリ指定生成

Parameters
name[in] アロケータ名
pAddress[in] ヒープアロケータ生成バッファポインタ
size[in] ヒープアロケータサイズ
Returns
ヒープアロケータポインタ
Here is the call graph for this function:

◆ destroy()

void GxAllocatorHeap::destroy ( GxAllocatorHeap *& pAllocator)
static

メモリ指定破棄

Parameters
pAllocator[in,out] メモリ指定生成にて取得したフレームアロケータポインタ
Note
セーフ破棄

◆ freeMemory()

void GxAllocatorHeap::freeMemory ( void * pAddress)
overridevirtual

メモリ解放

Parameters
pAddress[in] 解放アドレス
filename[in] 呼び出し元ファイル名 (※DEBUG時のみ)
line[in] 呼び出し元ソースライン番号 (※DEBUG時のみ)

Reimplemented from GxAllocator.

Here is the call graph for this function:

◆ getBlockFromSize()

GX_FORCE_INLINE u32 GxAllocatorHeap::getBlockFromSize ( u32 size)
static

サイズ → ブロック数取得

Parameters
size[in] サイズ (BLOCK_SIZEアライメント必須)
Returns
指定したサイズに対応するブロック数
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFreeMax()

u32 GxAllocatorHeap::getFreeMax ( void ) const

最大空き容量取得

Returns
最大空き容量
Note
ヒープの空き領域の最大値を取得します。
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHashValue()

u32 GxAllocatorHeap::getHashValue ( u32 value) const
protected

ハッシュ値の取得

Parameters
value[in] 必要ブロック数
Returns
ハッシュ番号
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHeaderPointer()

GX_FORCE_INLINE GxAllocatorHeap::GxHeapInformation * GxAllocatorHeap::getHeaderPointer ( void * pAddress)
static

確保メモリからヘッダーポインタ取得

Parameters
pAddress[in] 確保時取得アドレス
Returns
ヘッダーポインタ
Here is the call graph for this function:

◆ getHeaderSize()

GX_FORCE_INLINE u32 GxAllocatorHeap::getHeaderSize ( void )
static

ヘッダーサイズ取得 (※BLOCK_SIZEでのアライメント考慮)

Returns
BLOCK_SIZEアライメントでのヘッダーサイズ
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxAvailableSize()

u32 GxAllocatorHeap::getMaxAvailableSize ( GxMemory::ALIGNMENT alignment = GxMemory::ALIGNMENT::_16) const

最大確保可能サイズ取得

Parameters
alignment[in] アライメント
Returns
最大確保可能サイズ
Note
連続メモリとして取得可能なヒープの最大確保可能サイズを取得します。
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMemoryPointer()

GX_FORCE_INLINE void * GxAllocatorHeap::getMemoryPointer ( const GxAllocatorHeap::GxHeapInformation * pHeapInformation)
static

ヘッダーポインタから確保メモリを取得

Parameters
pHeapInformation[in] 確保時取得アドレス
Returns
ポインタ
Here is the call graph for this function:

◆ getSizeFromBlock()

GX_FORCE_INLINE u32 GxAllocatorHeap::getSizeFromBlock ( u32 block)
static

ブロック数 → サイズ取得

Parameters
block[in] ブロック数
Returns
指定したブロック数に対応するサイズ
Here is the caller graph for this function:

◆ initialize()

void GxAllocatorHeap::initialize ( void * pAddress,
u32 size )
protected

初期化

Parameters
pAddress[in] アロケータ割り当てメモリ
size[in] アロケータ割り当てサイズ
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertHeap()

void GxAllocatorHeap::insertHeap ( GxHeapInformation * pBaseHeap,
GxHeapInformation * pInsertHeap )
protected

新規ヒープ情報の挿入

Parameters
pBaseHeap[in,out] 挿入先ヒープ情報
pInsertHeap[in,out] 挿入ヒープ情報
Here is the caller graph for this function:

◆ isValid() [1/2]

b32 GxAllocatorHeap::isValid ( const GxHeapInformation * pHeapInformation) const

指定管理領域のチェック

Parameters
pHeapInformation[in] チェック対象ヒープ情報
Returns
成功ならtrue
Here is the call graph for this function:

◆ isValid() [2/2]

b32 GxAllocatorHeap::isValid ( void )

全体管理領域のチェック

Returns
成功ならtrue
Here is the call graph for this function:
Here is the caller graph for this function:

◆ linkFreeHeapList()

void GxAllocatorHeap::linkFreeHeapList ( GxHeapInformation * pNewHeap)
protected

空き領域ヒープリストの連結

Parameters
pNewHeap[in] 新規追加ヒープ情報
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reallocMemory()

void * GxAllocatorHeap::reallocMemory ( void * pAddress,
u32 size )
overridevirtual

メモリ割り当てサイズ変更

Parameters
pAddress[in] 変更元アドレス
size[in] 変更後サイズ
filename[in] 呼び出し元ファイル名 (※DEBUG時のみ)
line[in] 呼び出し元ソースライン番号 (※DEBUG時のみ)
Returns
変更後メモリアドレス (nullptrの場合:再確保失敗)

Reimplemented from GxAllocator.

Here is the call graph for this function:

The documentation for this class was generated from the following files: