Skip to content
Snippets Groups Projects
Commit 166b171d authored by patacongo's avatar patacongo
Browse files

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
parent 6e2d6f78
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment