Added an extremely simple memory leak tracker

xtremegamer1 2 years ago
parent 8d42008427
commit bed10c0c46

@ -0,0 +1,6 @@
#include <unicorn\unicorn.h>
extern int g_allocation_tracker;
uc_err uct_context_alloc(uc_engine *uc, uc_context **context);
uc_err uct_context_free(uc_context *context);

@ -0,0 +1,15 @@
#include <uc_allocation_tracker.hpp>
#include <cstdio>
int g_allocation_tracker;
uc_err uct_context_alloc(uc_engine *uc, uc_context **context)
{
std::printf("Allocations: %p\n", ++g_allocation_tracker);
return uc_context_alloc(uc, context);
}
uc_err uct_context_free(uc_context *context)
{
std::printf("Allocations: %p\n", --g_allocation_tracker);
return uc_context_free(context);
}
Loading…
Cancel
Save