Added an extremely simple memory leak tracker

master
xtremegamer1 1 year ago
parent ddd58c2a98
commit 0be31ec977

@ -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