initial commit

This change makes the memory manager work again for detecting leaks, the built in one kept coming into de-ref and other bugs so this is the start of a refactor to get it working.
This commit is contained in:
marauder2k7 2025-05-04 10:16:49 +01:00
parent 13bf126418
commit 8c812cb448
11 changed files with 258 additions and 1665 deletions

View file

@ -27,33 +27,22 @@
namespace Memory
{
enum EFlag
struct MemInfo
{
FLAG_Debug,
FLAG_Global,
FLAG_Static
void* ptr;
dsize_t size;
const char* file;
U32 line;
U32 allocId;
bool flagged;
void* backtracePtrs[16];
int backtraceSize;
};
struct Info
{
U32 mAllocNumber;
U32 mAllocSize;
const char* mFileName;
U32 mLineNumber;
bool mIsArray;
bool mIsGlobal;
bool mIsStatic;
};
void checkPtr( void* ptr );
void flagCurrentAllocs( EFlag flag = FLAG_Debug );
void ensureAllFreed();
void dumpUnflaggedAllocs(const char *file, EFlag flag = FLAG_Debug );
S32 countUnflaggedAllocs(const char *file, S32 *outUnflaggedRealloc = NULL, EFlag flag = FLAG_Debug );
dsize_t getMemoryUsed();
dsize_t getMemoryAllocated();
void getMemoryInfo( void* ptr, Info& info );
void validate();
void init();
void shutdown();
void checkPtr(void* ptr);
}
#endif // _TORQUE_PLATFORM_PLATFORMMEMORY_H_