From 5839bd01778e61c6ff301eac395bb0d4cf79946d Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 15 Mar 2017 15:36:12 -0700 Subject: [PATCH] add deallocs to memory tracker --- wolfssl/wolfcrypt/mem_track.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wolfssl/wolfcrypt/mem_track.h b/wolfssl/wolfcrypt/mem_track.h index beb280b3e..f24325eaf 100644 --- a/wolfssl/wolfcrypt/mem_track.h +++ b/wolfssl/wolfcrypt/mem_track.h @@ -64,6 +64,7 @@ typedef struct memoryStats { size_t totalAllocs; /* number of allocations */ + size_t totalDeallocs; /* number of deallocations */ size_t totalBytes; /* total number of bytes allocated */ size_t peakBytes; /* concurrent max bytes */ size_t currentBytes; /* total current bytes in use */ @@ -149,6 +150,7 @@ #ifdef DO_MEM_STATS ourMemStats.currentBytes -= mt->u.hint.thisSize; + ourMemStats.totalDeallocs++; #endif #ifdef WOLFSSL_DEBUG_MEMORY @@ -204,6 +206,7 @@ #ifdef DO_MEM_STATS ourMemStats.totalAllocs = 0; + ourMemStats.totalDeallocs = 0; ourMemStats.totalBytes = 0; ourMemStats.peakBytes = 0; ourMemStats.currentBytes = 0; @@ -217,6 +220,8 @@ #ifdef DO_MEM_STATS printf("total Allocs = %9lu\n", (unsigned long)ourMemStats.totalAllocs); + printf("total Deallocs = %9lu\n", + (unsigned long)ourMemStats.totalDeallocs); printf("total Bytes = %9lu\n", (unsigned long)ourMemStats.totalBytes); printf("peak Bytes = %9lu\n",