diff --git a/include/uc_allocation_tracker.hpp b/include/uc_allocation_tracker.hpp index 8dd1aa2..ac50d6b 100644 --- a/include/uc_allocation_tracker.hpp +++ b/include/uc_allocation_tracker.hpp @@ -3,4 +3,5 @@ extern int g_allocation_tracker; uc_err uct_context_alloc(uc_engine *uc, uc_context **context); -uc_err uct_context_free(uc_context *context); \ No newline at end of file +uc_err uct_context_free(uc_context *context); +void print_allocation_number(); \ No newline at end of file diff --git a/src/uc_allocation_tracker.cpp b/src/uc_allocation_tracker.cpp index 076c208..95fc2a4 100644 --- a/src/uc_allocation_tracker.cpp +++ b/src/uc_allocation_tracker.cpp @@ -5,11 +5,18 @@ int g_allocation_tracker; uc_err uct_context_alloc(uc_engine *uc, uc_context **context) { - std::printf("Allocations: %p\n", ++g_allocation_tracker); + ++g_allocation_tracker; + //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); + +g_allocation_tracker--; + //std::printf("Allocations: %p\n", g_allocation_tracker); return uc_context_free(context); +} + +void print_allocation_number() +{ + std::printf("uc_context allocations: %p\n", g_allocation_tracker); } \ No newline at end of file