1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-07 19:18:19 +02:00
Beef/IDEHelper/HotHeap.h
2022-07-30 09:11:38 -04:00

46 lines
No EOL
920 B
C++

#pragma once
#include "DebugCommon.h"
#include "BeefySysLib/util/Dictionary.h"
#include "BeefySysLib/util/Array.h"
NS_BF_DBG_BEGIN
class HotHeap
{
public:
enum HotUseFlags
{
HotUseFlags_None,
HotUseFlags_Allocated,
HotUseFlags_Referenced
};
public:
static const int BLOCK_SIZE = 4096;
addr_target mHotAreaStart;
int mHotAreaSize;
Beefy::Array<HotUseFlags> mHotAreaUsed;
int mCurBlockIdx;
int mBlockAllocIdx; // Total blocks allocated, doesn't decrease with frees
Beefy::Dictionary<addr_target, int> mTrackedMap;
public:
HotHeap(addr_target hotStart, int size);
HotHeap();
void AddTrackedRegion(addr_target hotStart, int size);
addr_target Alloc(int size);
void Release(addr_target addr, int size);
void MarkBlockReferenced(addr_target addr);
bool IsReferenced(addr_target addr, int size);
bool IsBlockUsed();
void ClearReferencedFlags();
intptr_target GetUsedSize();
};
NS_BF_DBG_END