Merge pull request #798 from toddouska/trackmem

add deallocs to memory tracker
This commit is contained in:
JacobBarthelmeh 2017-03-22 13:59:29 -06:00 committed by GitHub
commit a216da38d2

View File

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