[*] Fix main process heap fragmentation caused by shared pointer blocks, always allocate from within the heap object

This commit is contained in:
Reece Wilson 2024-07-13 03:07:02 +01:00
parent 46ef3231a2
commit 124e9d1d0a

View File

@ -13,6 +13,9 @@ namespace Aurora::Memory
static const AuUInt8 kHeapSize = 128; static const AuUInt8 kHeapSize = 128;
static const AuUInt8 kHeap2Size = 255; static const AuUInt8 kHeap2Size = 255;
template <class T>
struct CppHeapWrapper;
struct Heap struct Heap
{ {
virtual AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment = 32) = 0; virtual AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment = 32) = 0;
@ -230,7 +233,7 @@ namespace Aurora::Memory
auto pTThat = (T *)(pPtr + kAlignment); auto pTThat = (T *)(pPtr + kAlignment);
AUROXTL_COMMODITY_TRY AUROXTL_COMMODITY_TRY
{ {
return AuSPtr<T>(pTThat, &Heap::DeleteThat<T>); return AuSPtr<T>(pTThat, &Heap::DeleteThat<T>, CppHeapWrapper<T> { this });
} }
AUROXTL_COMMODITY_CATCH AUROXTL_COMMODITY_CATCH
{ {
@ -340,7 +343,7 @@ namespace Aurora::Memory
auto pTThat = (T *)(pPtr + kAlignment); auto pTThat = (T *)(pPtr + kAlignment);
AUROXTL_COMMODITY_TRY AUROXTL_COMMODITY_TRY
{ {
return AuSPtr<T>(pTThat, &Heap::DeleteThatArray<T>); return AuSPtr<T>(pTThat, &Heap::DeleteThatArray<T>, CppHeapWrapper<T> { this });
} }
AUROXTL_COMMODITY_CATCH AUROXTL_COMMODITY_CATCH
{ {