#include <ExpHeap.hh>
Low-level implementation of a memory heap for managing dynamic memory allocation. Allocation may occur anywhere within the memory space the heap is created from.
Due to requesting chunks from a provided memory block, internal fragmentation is non-existent, but external fragmentation is still possible. Allocating temporary blocks from the tail, and scene-permanent blocks from the head, is recommended. The memory overhead per allocation is sizeof(MEMiExpBlockHead).
Definition at line 72 of file ExpHeap.hh.
Public Types | |
| typedef std::function< void(void *, MEMiHeapHead *, uintptr_t)> | Visitor |
| Public Types inherited from Kinoko::Abstract::Memory::MEMiHeapHead | |
| enum class | FillType { NoUse = 0 , Alloc = 1 , Free = 2 } |
| enum class | eOptFlag { ZeroFillAlloc = 0 , DebugFillAlloc = 1 } |
| typedef EGG::TBitFlag< u16, eOptFlag > | OptFlag |
Public Member Functions | |
| void | destroy () |
| void * | alloc (size_t size, s32 align) |
| void | free (void *block) |
| u32 | getAllocatableSize (s32 align) const |
| void | visitAllocated (Visitor visitor, uintptr_t param) |
| u16 | getGroupID () const |
| void | setGroupID (u16 groupID) |
| void * | calcUsedEnd () |
| Helper function which finds the end of the used heap region (including the tail head). | |
| Public Member Functions inherited from Kinoko::Abstract::Memory::MEMiHeapHead | |
| MEMList & | getChildList () |
| void * | getHeapStart () |
| void * | getHeapEnd () |
Static Public Member Functions | |
| static MEMiExpHeapHead * | create (void *startAddress, size_t size, u16 flag) |
| Static Public Member Functions inherited from Kinoko::Abstract::Memory::MEMiHeapHead | |
| static MEMList & | getRootList () |
| static u32 | getFillVal (FillType type) |
| static MEMiHeapHead * | findContainHeap (const void *block) |
| static constexpr u16 | getLinkOffset () |
Private Types | |
| enum class | eAttribute { BestFitAlloc = 0 } |
| typedef EGG::TBitFlag< u16, eAttribute > | Attribute |
Private Member Functions | |
| MEMiExpHeapHead (void *end, u16 opt) | |
| void * | allocFromHead (size_t size, s32 alignment) |
| void * | allocFromTail (size_t size, s32 alignment) |
| void * | allocUsedBlockFromFreeBlock (MEMiExpBlockHead *block, void *address, u32 size, s32 direction) |
| bool | recycleRegion (const Region &initialRegion) |
Private Attributes | |
| MEMiExpBlockList | m_freeBlocks |
| MEMiExpBlockList | m_usedBlocks |
| u16 | m_groupId |
| Attribute | m_attribute |
Static Private Attributes | |
| static constexpr u32 | EXP_HEAP_SIGNATURE = 0x45585048 |
Additional Inherited Members | |
| Protected Member Functions inherited from Kinoko::Abstract::Memory::MEMiHeapHead | |
| MEMiHeapHead (u32 signature, void *heapStart, void *heapEnd, const OptFlag &opt) | |
| void | fillNoUseMemory (void *address, u32 size) |
| void | fillAllocMemory (void *address, u32 size) |
| void | fillFreeMemory (void *address, u32 size) |
|
private |
Definition at line 97 of file ExpHeap.hh.
| typedef std::function<void(void *, MEMiHeapHead *, uintptr_t)> Kinoko::Abstract::Memory::MEMiExpHeapHead::Visitor |
Definition at line 78 of file ExpHeap.hh.
|
strongprivate |
Definition at line 94 of file ExpHeap.hh.
|
private |
Definition at line 91 of file ExpHeap.cc.
|
privatedefault0x80198D58 |
|
0x80198D88 |
Definition at line 137 of file ExpHeap.cc.
|
nodiscardprivate0x8019899C |
Definition at line 228 of file ExpHeap.cc.
|
nodiscardprivate0x80198A78 |
Definition at line 264 of file ExpHeap.cc.
|
nodiscardprivate0x80198798 |
Definition at line 300 of file ExpHeap.cc.
| void * Kinoko::Abstract::Memory::MEMiExpHeapHead::calcUsedEnd | ( | ) |
Helper function which finds the end of the used heap region (including the tail head).
This is used by Host::Context to discern the minimum memcpy size required to preserve the entire state of the heap. Falls back to getHeapHead() if the tail block is not found.
Definition at line 218 of file ExpHeap.cc.
|
static0x80198CA8 |
Definition at line 112 of file ExpHeap.cc.
| void Kinoko::Abstract::Memory::MEMiExpHeapHead::destroy | ( | ) |
Definition at line 132 of file ExpHeap.cc.
|
0x80199038 |
Definition at line 154 of file ExpHeap.cc.
|
nodiscard0x80199180 |
Definition at line 168 of file ExpHeap.cc.
|
nodiscard0x8019934C |
Definition at line 204 of file ExpHeap.cc.
|
private |
Definition at line 344 of file ExpHeap.cc.
|
0x80199258 |
Definition at line 209 of file ExpHeap.cc.
|
0x801992A8 |
Definition at line 195 of file ExpHeap.cc.
|
staticconstexprprivate |
Definition at line 113 of file ExpHeap.hh.
|
private |
Definition at line 111 of file ExpHeap.hh.
|
private |
Definition at line 105 of file ExpHeap.hh.
|
private |
Definition at line 107 of file ExpHeap.hh.
|
private |
Definition at line 106 of file ExpHeap.hh.