From: Michael D. Lowis Date: Wed, 20 Aug 2014 02:43:46 +0000 (-0400) Subject: Update mem module to count allocations and deletions for a lightweight form of leak... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=cd8df67f20c1759e58cd1b27c10ad9876c554bfe;p=projs%2Flibcds.git Update mem module to count allocations and deletions for a lightweight form of leak detection --- diff --git a/source/mem/mem.c b/source/mem/mem.c index 81b9b2d..643219b 100644 --- a/source/mem/mem.c +++ b/source/mem/mem.c @@ -158,6 +158,8 @@ void mem_release(void* p_obj) { #if (LEAK_DETECT_LEVEL == 2) deregister_block(p_obj); + #elif (LEAK_DETECT_LEVEL == 1) + Num_Allocations--; #endif if(p_hdr->p_finalize) { diff --git a/tests/test_list.c b/tests/test_list.c index cd61a72..5965223 100644 --- a/tests/test_list.c +++ b/tests/test_list.c @@ -20,6 +20,7 @@ TEST_SUITE(List) { CHECK( NULL != list ); CHECK( NULL == list->head ); CHECK( NULL == list->tail ); + mem_release( list ); } //-------------------------------------------------------------------------