1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00
Beef/IDEHelper/HotHeap.h
2019-08-23 11:56:54 -07:00

46 lines
No EOL
925 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