From 166b171d431c8f78db6632253c49315398dc2149 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 13 Sep 2009 22:35:04 +0000 Subject: [PATCH] Keep track of number of time free called git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2050 42af7a65-404d-4744-a932-0658087f49c3 --- netutils/thttpd/thttpd_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netutils/thttpd/thttpd_alloc.c b/netutils/thttpd/thttpd_alloc.c index a4d64e3c6d9..71c71397b4d 100755 --- a/netutils/thttpd/thttpd_alloc.c +++ b/netutils/thttpd/thttpd_alloc.c @@ -67,6 +67,7 @@ #ifdef CONFIG_THTTPD_MEMDEBUG static int g_nallocations = 0; +static int g_nfreed = 0; static size_t g_allocated = 0; #endif @@ -81,7 +82,7 @@ void httpd_memstats(void) { static struct mallinfo mm; - ndbg("%d allocations (%lu bytes)\n", g_nallocations, (unsigned long)g_allocated); + ndbg("%d allocations (%lu bytes), %d freed\n", g_nallocations, (unsigned long)g_allocated, g_nfreed); /* Get the current memory usage */ @@ -142,6 +143,7 @@ FAR void *httpd_realloc(FAR void *oldptr, size_t oldsize, size_t newsize) void httpd_free(FAR void *ptr) { free(ptr); + g_nfreed++; nvdbg("Freed memory at %p\n", ptr); httpd_memstats(); }