CommonLibVR
Loading...
Searching...
No Matches
BSSmallBlockAllocator.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BSAtomic.h"
4#include "RE/I/IMemoryStore.h"
5
6namespace RE
7{
8 namespace BSSmallBlockAllocatorUtil
9 {
10 struct FreeBlock
11 {
12 public:
13 // members
15 };
16 static_assert(sizeof(FreeBlock) == 0x8);
17
18 struct BlockPage
19 {
20 public:
21 // members
25 std::uint16_t totalElem; // 18
26 std::uint16_t freeElem; // 1A
27 std::uint32_t pad1C; // 1C
28 };
29 static_assert(sizeof(BlockPage) == 0x20);
30
31 struct Pool
32 {
33 public:
34 // members
37 std::uint32_t totalFreeBlocks; // 10
38 std::uint32_t totalAllocatedBlocks; // 14
39 std::uint32_t totalBytes; // 18
40 std::uint32_t elementSize; // 1C
42 };
43 static_assert(sizeof(Pool) == 0x48);
44 }
45
47 {
48 public:
49 // members
53 std::uint16_t totalElem; // 18
54 std::uint16_t freeElem; // 1A
55 std::uint16_t elemSize; // 1C
56 std::uint16_t check; // 1E
57 };
58 static_assert(sizeof(BlockPageInternal) == 0x20);
59
61 {
62 public:
63 inline static constexpr auto RTTI = RTTI_BSSmallBlockAllocator;
64 inline static constexpr auto VTABLE = VTABLE_BSSmallBlockAllocator;
65
67 {
68 public:
69 };
70 static_assert(sizeof(Pool) == 0x48);
71
73 {
74 public:
75 // members
76 char mem[sizeof(BlockPageInternal[255]) * 256]; // 000000
78 MegaBlockPage* left; // 1FFFE0
79 MegaBlockPage* right; // 1FFFE8
81 std::uint16_t numFreeBlockPages; // 1FFFF8
82 std::uint16_t nextBlockPageAlloc; // 1FFFFA
83 bool decommitted; // 1FFFFC
84 std::uint8_t pad1FFFFD; // 1FFFFD
85 std::uint16_t pad1FFFFE; // 1FFFFE
86 };
87 static_assert(sizeof(MegaBlockPage) == 0x200000);
88
89 ~BSSmallBlockAllocator() override; // 00
90
91 // override (IMemoryStore)
92 std::size_t Size(const void* a_block) const override; // 01
93 void GetMemoryStats(MemoryStats* a_stats) override; // 02
94 bool ContainsBlockImpl(const void* a_block) const override; // 03
95 void* AllocateAlignImpl(std::size_t a_size, std::uint32_t a_alignment) override; // 04
96 void DeallocateAlignImpl(void*& a_freeBlock) override; // 05
97 void* TryAllocateImpl(std::size_t a_size, std::uint32_t a_alignment) override; // 06
98
99 // members
100 Pool pools[64]; // 0008
102 std::uint32_t addressSpaceSize; // 1230
103 std::uint32_t pad1234; // 1234
104 char* allocBase; // 1238
105 char* blockPageCommitMin; // 1240
106 char* blockPageCommit; // 1248
109 std::uint32_t totalFreeBlockPages; // 1260
110 bool allowDecommits; // 1264
111 std::uint8_t pad1265; // 1265
112 std::uint16_t pad1266; // 1266
113 private:
115 };
116 static_assert(sizeof(BSSmallBlockAllocator) == 0x1268);
117}
#define KEEP_FOR_RE()
Definition PCH.h:517
Definition BSAtomic.h:49
Definition BSSmallBlockAllocator.h:61
std::uint16_t pad1266
Definition BSSmallBlockAllocator.h:112
MegaBlockPage * megaBlockCurrAlloc
Definition BSSmallBlockAllocator.h:108
char * allocBase
Definition BSSmallBlockAllocator.h:104
void * TryAllocateImpl(std::size_t a_size, std::uint32_t a_alignment) override
std::size_t Size(const void *a_block) const override
std::uint32_t addressSpaceSize
Definition BSSmallBlockAllocator.h:102
void DeallocateAlignImpl(void *&a_freeBlock) override
static constexpr auto RTTI
Definition BSSmallBlockAllocator.h:63
~BSSmallBlockAllocator() override
std::uint32_t totalFreeBlockPages
Definition BSSmallBlockAllocator.h:109
std::uint32_t pad1234
Definition BSSmallBlockAllocator.h:103
bool ContainsBlockImpl(const void *a_block) const override
void GetMemoryStats(MemoryStats *a_stats) override
BSCriticalSection lock
Definition BSSmallBlockAllocator.h:101
std::uint8_t pad1265
Definition BSSmallBlockAllocator.h:111
bool allowDecommits
Definition BSSmallBlockAllocator.h:110
static constexpr auto VTABLE
Definition BSSmallBlockAllocator.h:64
char * blockPageCommit
Definition BSSmallBlockAllocator.h:106
void * AllocateAlignImpl(std::size_t a_size, std::uint32_t a_alignment) override
Pool pools[64]
Definition BSSmallBlockAllocator.h:100
MegaBlockPage * megaBlockPageList
Definition BSSmallBlockAllocator.h:107
char * blockPageCommitMin
Definition BSSmallBlockAllocator.h:105
Definition IMemoryStore.h:8
Definition AbsorbEffect.h:6
constexpr std::array< REL::ID, 1 > VTABLE_BSSmallBlockAllocator
Definition Offsets_VTABLE.h:9849
constexpr REL::ID RTTI_BSSmallBlockAllocator(static_cast< std::uint64_t >(690291))
Definition BSSmallBlockAllocator.h:19
BlockPage * right
Definition BSSmallBlockAllocator.h:23
BlockPage * left
Definition BSSmallBlockAllocator.h:22
std::uint32_t pad1C
Definition BSSmallBlockAllocator.h:27
FreeBlock * blocks
Definition BSSmallBlockAllocator.h:24
std::uint16_t totalElem
Definition BSSmallBlockAllocator.h:25
std::uint16_t freeElem
Definition BSSmallBlockAllocator.h:26
Definition BSSmallBlockAllocator.h:11
FreeBlock * next
Definition BSSmallBlockAllocator.h:14
Definition BSSmallBlockAllocator.h:32
BSCriticalSection lock
Definition BSSmallBlockAllocator.h:41
std::uint32_t totalBytes
Definition BSSmallBlockAllocator.h:39
std::uint32_t totalFreeBlocks
Definition BSSmallBlockAllocator.h:37
std::uint32_t elementSize
Definition BSSmallBlockAllocator.h:40
BlockPage * currAlloc
Definition BSSmallBlockAllocator.h:36
BlockPage * pageList
Definition BSSmallBlockAllocator.h:35
std::uint32_t totalAllocatedBlocks
Definition BSSmallBlockAllocator.h:38
Definition BSSmallBlockAllocator.h:73
MegaBlockPage * left
Definition BSSmallBlockAllocator.h:78
BSSmallBlockAllocatorUtil::BlockPage * freeBlockPages
Definition BSSmallBlockAllocator.h:80
bool decommitted
Definition BSSmallBlockAllocator.h:83
char mem[sizeof(BlockPageInternal[255]) *256]
Definition BSSmallBlockAllocator.h:76
std::uint16_t numFreeBlockPages
Definition BSSmallBlockAllocator.h:81
std::uint16_t pad1FFFFE
Definition BSSmallBlockAllocator.h:85
MegaBlockPage * right
Definition BSSmallBlockAllocator.h:79
std::uint8_t pad1FFFFD
Definition BSSmallBlockAllocator.h:84
std::uint16_t nextBlockPageAlloc
Definition BSSmallBlockAllocator.h:82
BlockPageInternal blockPages[255]
Definition BSSmallBlockAllocator.h:77
Definition BSSmallBlockAllocator.h:67
Definition BSSmallBlockAllocator.h:47
std::uint16_t freeElem
Definition BSSmallBlockAllocator.h:54
std::uint16_t totalElem
Definition BSSmallBlockAllocator.h:53
BlockPageInternal * left
Definition BSSmallBlockAllocator.h:50
BSSmallBlockAllocatorUtil::FreeBlock * blocks
Definition BSSmallBlockAllocator.h:52
BlockPageInternal * right
Definition BSSmallBlockAllocator.h:51
std::uint16_t elemSize
Definition BSSmallBlockAllocator.h:55
std::uint16_t check
Definition BSSmallBlockAllocator.h:56
Definition IMemoryStoreBase.h:6