CommonLibSSE (Parapets fork)
hkMemoryAllocator.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/H/hkBaseTypes.h"
4 
5 namespace RE
6 {
8  {
9  public:
10  inline static constexpr auto RTTI = RTTI_hkMemoryAllocator;
11 
12  using MemoryWalkCallback = void(void* a_start, std::size_t a_size, bool a_allocated, std::int32_t a_pool, void* a_param);
13 
14  enum class MemoryState
15  {
16  kOK,
18  };
19 
21  {
22  public:
23  static constexpr std::int64_t INFINITE_SIZE = -1;
24 
25  // members
26  std::int64_t allocated; // 00
27  std::int64_t inUse; // 08
28  std::int64_t peakInUse; // 10
29  std::int64_t available; // 18
30  std::int64_t totalAvailable; // 20
31  std::int64_t largestBlock; // 28
32  };
33  static_assert(sizeof(MemoryStatistics) == 0x30);
34 
36  {
37  public:
38  virtual ~ExtendedInterface(); // 00
39 
40  // add
41  virtual void GarbageCollect() = 0; // 01
42  virtual void IncrementalGarbageCollect(std::int32_t a_numBlocks) = 0; // 02
43  virtual hkResult SetMemorySoftLimit(std::size_t a_maxMemory) = 0; // 03
44  [[nodiscard]] virtual std::size_t GetMemorySoftLimit() const = 0; // 04
45  virtual bool CanAllocTotal(std::int32_t a_numBytes) = 0; // 05
46  virtual hkResult WalkMemory(MemoryWalkCallback* a_callback, void* a_param) = 0; // 06
47  };
48  static_assert(sizeof(ExtendedInterface) == 0x8);
49 
50  virtual ~hkMemoryAllocator(); // 00
51 
52  // add
53  virtual void* BlockAlloc(std::int32_t a_numBytes) = 0; // 01
54  virtual void BlockFree(void* a_ptr, std::int32_t a_numBytes) = 0; // 02
55  virtual void* BufAlloc(std::int32_t& a_reqNumBytesInOut); // 03
56  virtual void BufFree(void* a_ptr, std::int32_t a_numBytes); // 04
57  virtual void* BufRealloc(void* a_ptrOld, std::int32_t a_oldNumBytes, std::int32_t& a_reqNumBytesInOut); // 05
58  virtual void BlockAllocBatch(void** a_ptrsOut, std::int32_t a_numPtrs, std::int32_t a_blockSize); // 06
59  virtual void BlockFreeBatch(void** a_ptrsIn, std::int32_t a_numPtrs, std::int32_t a_blockSize); // 07
60  virtual void GetMemoryStatistics(MemoryStatistics& a_usage) = 0; // 08
61  virtual std::int32_t GetAllocatedSize(const void* a_obj, std::int32_t a_numBytes) = 0; // 09
62  virtual void ResetPeakMemoryStatistics(); // 0A - { return; }
63  };
64  static_assert(sizeof(hkMemoryAllocator) == 0x8);
65 }
Definition: hkMemoryAllocator.h:8
static constexpr auto RTTI
Definition: hkMemoryAllocator.h:10
virtual void * BufAlloc(std::int32_t &a_reqNumBytesInOut)
void(void *a_start, std::size_t a_size, bool a_allocated, std::int32_t a_pool, void *a_param) MemoryWalkCallback
Definition: hkMemoryAllocator.h:12
virtual void ResetPeakMemoryStatistics()
virtual ~hkMemoryAllocator()
virtual void BlockAllocBatch(void **a_ptrsOut, std::int32_t a_numPtrs, std::int32_t a_blockSize)
virtual void BlockFree(void *a_ptr, std::int32_t a_numBytes)=0
virtual void * BufRealloc(void *a_ptrOld, std::int32_t a_oldNumBytes, std::int32_t &a_reqNumBytesInOut)
virtual std::int32_t GetAllocatedSize(const void *a_obj, std::int32_t a_numBytes)=0
MemoryState
Definition: hkMemoryAllocator.h:15
virtual void GetMemoryStatistics(MemoryStatistics &a_usage)=0
virtual void * BlockAlloc(std::int32_t a_numBytes)=0
virtual void BlockFreeBatch(void **a_ptrsIn, std::int32_t a_numPtrs, std::int32_t a_blockSize)
virtual void BufFree(void *a_ptr, std::int32_t a_numBytes)
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_hkMemoryAllocator
Definition: Offsets_RTTI.h:7190
hkResult
Definition: hkBaseTypes.h:9
Definition: hkMemoryAllocator.h:36
virtual hkResult SetMemorySoftLimit(std::size_t a_maxMemory)=0
virtual hkResult WalkMemory(MemoryWalkCallback *a_callback, void *a_param)=0
virtual std::size_t GetMemorySoftLimit() const =0
virtual void IncrementalGarbageCollect(std::int32_t a_numBlocks)=0
virtual bool CanAllocTotal(std::int32_t a_numBytes)=0
Definition: hkMemoryAllocator.h:21
std::int64_t largestBlock
Definition: hkMemoryAllocator.h:31
std::int64_t totalAvailable
Definition: hkMemoryAllocator.h:30
std::int64_t allocated
Definition: hkMemoryAllocator.h:26
std::int64_t available
Definition: hkMemoryAllocator.h:29
std::int64_t peakInUse
Definition: hkMemoryAllocator.h:28
std::int64_t inUse
Definition: hkMemoryAllocator.h:27
static constexpr std::int64_t INFINITE_SIZE
Definition: hkMemoryAllocator.h:23