CommonLibSSE (powerof3)
Loading...
Searching...
No Matches
IMemoryHeap.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/I/IMemoryStore.h"
4
5namespace RE
6{
7 enum class MEM_CONTEXT : std::int32_t;
8
9 struct HeapStats
10 {
11 public:
12 // members
13 const char* heapName; // 00
14 std::size_t memHeapSize; // 08
15 std::size_t memHeapCommitted; // 10
16 std::size_t memAllocatedToBlocks; // 18
17 std::int32_t numBlocks; // 20
18 std::int32_t numFreeBlocks; // 24
19 std::size_t memFreeInBlocks; // 28
20 std::size_t memUsedInBlocks; // 30
21 std::size_t smallestFreeBlock; // 38
22 std::size_t largestFreeBlock; // 40
23 std::size_t heapOverhead; // 48
24 std::size_t freeListOverhead; // 50
25 std::size_t blockOverhead; // 58
26 std::size_t totalFree; // 60
27 };
28 static_assert(sizeof(HeapStats) == 0x68);
29
31 {
32 public:
33 inline static constexpr auto RTTI = RTTI_IMemoryHeap;
34 inline static constexpr auto VTABLE = VTABLE_IMemoryHeap;
35
36 ~IMemoryHeap() override = default; // 00
37
38 // override (IMemoryStore)
39 bool ContainsBlockImpl(const void* a_block) const override { return PointerInHeap(a_block); } // 03
40 void* AllocateAlignImpl(std::size_t a_size, std::uint32_t a_alignment) override { return Allocate(a_size, a_alignment); } // 04
41 void DeallocateAlignImpl(void*& a_block) override { Deallocate(a_block, 0); } // 05
42
43 // add
44 [[nodiscard]] virtual const char* GetName() const = 0; // 07
45 virtual void* Allocate(std::size_t a_size, std::uint32_t a_alignment) = 0; // 08
46 virtual void Deallocate(void* a_mem, std::uint32_t) = 0; // 09
47 virtual bool PointerInHeap(const void* a_pointer) const = 0; // 0A
48 virtual std::size_t TotalSize(const void* a_pointer) const = 0; // 0B
49 virtual void GetHeapStats(HeapStats* a_stats, bool a_fullBlockInfo) = 0; // 0C
50 virtual bool ShouldTrySmallBlockPools(std::size_t a_size, MEM_CONTEXT a_context) = 0; // 0D
51 [[nodiscard]] virtual std::uint32_t GetPageSize() const = 0; // 0E
52 };
53 static_assert(sizeof(IMemoryHeap) == 0x8);
54}
Definition IMemoryHeap.h:31
void * AllocateAlignImpl(std::size_t a_size, std::uint32_t a_alignment) override
Definition IMemoryHeap.h:40
void DeallocateAlignImpl(void *&a_block) override
Definition IMemoryHeap.h:41
~IMemoryHeap() override=default
virtual bool ShouldTrySmallBlockPools(std::size_t a_size, MEM_CONTEXT a_context)=0
virtual std::size_t TotalSize(const void *a_pointer) const =0
virtual const char * GetName() const =0
static constexpr auto VTABLE
Definition IMemoryHeap.h:34
virtual std::uint32_t GetPageSize() const =0
virtual bool PointerInHeap(const void *a_pointer) const =0
virtual void Deallocate(void *a_mem, std::uint32_t)=0
bool ContainsBlockImpl(const void *a_block) const override
Definition IMemoryHeap.h:39
static constexpr auto RTTI
Definition IMemoryHeap.h:33
virtual void GetHeapStats(HeapStats *a_stats, bool a_fullBlockInfo)=0
virtual void * Allocate(std::size_t a_size, std::uint32_t a_alignment)=0
Definition IMemoryStore.h:8
Definition AbsorbEffect.h:6
constexpr std::array< REL::ID, 1 > VTABLE_IMemoryHeap
Definition Offsets_VTABLE.h:11803
constexpr REL::ID RTTI_IMemoryHeap(static_cast< std::uint64_t >(690287))
Definition IMemoryHeap.h:10
std::size_t smallestFreeBlock
Definition IMemoryHeap.h:21
std::size_t totalFree
Definition IMemoryHeap.h:26
std::size_t memFreeInBlocks
Definition IMemoryHeap.h:19
std::int32_t numFreeBlocks
Definition IMemoryHeap.h:18
std::size_t memUsedInBlocks
Definition IMemoryHeap.h:20
const char * heapName
Definition IMemoryHeap.h:13
std::size_t memHeapSize
Definition IMemoryHeap.h:14
std::size_t blockOverhead
Definition IMemoryHeap.h:25
std::size_t memHeapCommitted
Definition IMemoryHeap.h:15
std::size_t heapOverhead
Definition IMemoryHeap.h:23
std::int32_t numBlocks
Definition IMemoryHeap.h:17
std::size_t memAllocatedToBlocks
Definition IMemoryHeap.h:16
std::size_t largestFreeBlock
Definition IMemoryHeap.h:22
std::size_t freeListOverhead
Definition IMemoryHeap.h:24