#pragma once #include #include #include #include #include #include struct AllocationInfo { uint32_t size; std::vector stackTrace; }; struct PluginMemorySnapshot { uint32_t currentAllocated = 0; uint32_t peakAllocated = 0; uint32_t allocCount = 0; uint32_t freeCount = 0; std::string pluginName = {}; std::map allocationMap; }; class IPluginHeapMemoryAllocator { public: virtual ~IPluginHeapMemoryAllocator() = default; /** * The returned address needs to be valid for the whole time */ virtual MEMAllocFromDefaultHeapFn *GetAllocFunctionAddress() const = 0; /** * The returned address needs to be valid for the whole time */ virtual MEMAllocFromDefaultHeapExFn *GetAllocExFunctionAddress() const = 0; /** * The returned address needs to be valid for the whole time */ virtual MEMFreeToDefaultHeapFn *GetFreeFunctionAddress() const = 0; virtual std::optional GetHeapMemoryUsageSnapshot() const = 0; };