CommonLibSSE (Parapets fork)
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
35 ~IMemoryHeap() override = default; // 00
36
37 // override (IMemoryStore)
38 bool ContainsBlockImpl(const void* a_block) const override { return PointerInHeap(a_block); } // 03
39 void* AllocateAlignImpl(std::size_t a_size, std::uint32_t a_alignment) override { return Allocate(a_size, a_alignment); } // 04
40 void DeallocateAlignImpl(void*& a_block) override { Deallocate(a_block, 0); } // 05
41
42 // add
43 [[nodiscard]] virtual const char* GetName() const = 0; // 07
44 virtual void* Allocate(std::size_t a_size, std::uint32_t a_alignment) = 0; // 08
45 virtual void Deallocate(void* a_mem, std::uint32_t) = 0; // 09
46 virtual bool PointerInHeap(const void* a_pointer) const = 0; // 0A
47 virtual std::size_t TotalSize(const void* a_pointer) const = 0; // 0B
48 virtual void GetHeapStats(HeapStats* a_stats, bool a_fullBlockInfo) = 0; // 0C
49 virtual bool ShouldTrySmallBlockPools(std::size_t a_size, MEM_CONTEXT a_context) = 0; // 0D
50 [[nodiscard]] virtual std::uint32_t GetPageSize() const = 0; // 0E
51 };
52 static_assert(sizeof(IMemoryHeap) == 0x8);
53}
Definition: IMemoryHeap.h:31
void * AllocateAlignImpl(std::size_t a_size, std::uint32_t a_alignment) override
Definition: IMemoryHeap.h:39
void DeallocateAlignImpl(void *&a_block) override
Definition: IMemoryHeap.h:40
~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
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:38
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 REL::ID RTTI_IMemoryHeap
Definition: Offsets_RTTI.h:4950
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