2024-01-16 21:11:08 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
2024-03-19 15:47:42 +00:00
|
|
|
File: AuHeapProxy.hpp
|
2024-01-16 21:11:08 +00:00
|
|
|
Date: 2024-1-16
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
|
|
|
|
namespace Aurora::Memory
|
|
|
|
{
|
|
|
|
struct ProxyHeap : BaseHeap
|
|
|
|
{
|
|
|
|
std::shared_ptr<Heap> pHeap;
|
|
|
|
LeakFinderAlloc_f pAlloc;
|
|
|
|
LeakFinderFree_f pFree;
|
|
|
|
AuUInt64 uBytesAllocated {}; // current
|
|
|
|
AuUInt64 uBytesPeak {}; // max
|
|
|
|
AuUInt64 uBytesFree {}; // free count
|
|
|
|
AuUInt64 uBytesLifetime {}; // alloc count
|
|
|
|
|
|
|
|
ProxyHeap(std::shared_ptr<Heap> pHeap,
|
|
|
|
LeakFinderAlloc_f pAlloc = {},
|
|
|
|
LeakFinderFree_f pFree = {});
|
|
|
|
|
|
|
|
void UpdateStats() override;
|
|
|
|
|
|
|
|
AuSPtr<Heap> GetSelfReference() override;
|
|
|
|
Heap *GetSelfReferenceRaw() override;
|
|
|
|
AuSPtr<Heap> AllocateDivision(AuUInt32 heap, AuUInt32 alignment) override;
|
|
|
|
void *_ZAlloc(Types::size_t length) override;
|
|
|
|
void *_ZAlloc(Types::size_t length, Types::size_t align) override;
|
|
|
|
Types::size_t GetChunkSize(const void *head) override;
|
|
|
|
void *_FAlloc(Types::size_t length) override;
|
|
|
|
void *_FAlloc(Types::size_t length, Types::size_t align) override;
|
|
|
|
void *_ZRealloc(void *buffer, Types::size_t length, Types::size_t align) override;
|
|
|
|
void *_ZRealloc(void *buffer, Types::size_t length) override;
|
|
|
|
void *_FRealloc(void *buffer, Types::size_t length, Types::size_t align) override;
|
|
|
|
void *_FRealloc(void *buffer, Types::size_t length) override;
|
|
|
|
void _Free(void *buffer) override;
|
2024-03-04 04:44:49 +00:00
|
|
|
void WalkHeap(bool(*fCallback)(void *, void *), void *pSecondArg) override;
|
2024-01-16 21:11:08 +00:00
|
|
|
};
|
|
|
|
}
|