I'm also searching for function which returns the amount of memory usage.
I only found function mallinfo from newlib, but it gives not the information I need.
But maybe enought for your application.
Regards
Usage:
#include <malloc.h>
struct mallinfo meminfo;
meminfo=mallinfo();
# define OUT(DATA) printf("meminfo.%s = %d\n",#DATA,meminfo.DATA);
OUT(arena); // This is the total size of memory allocated with sbrk by malloc, in bytes.
OUT(ordblks); // This is the number of chunks not in use.
OUT(hblks); // This is the total number of chunks allocated with mmap.
OUT(hblkhd); // This is the total size of memory allocated with mmap, in bytes.
OUT(uordblks); // This is the total size of memory occupied by chunks handed out by malloc.
OUT(fordblks); // This is the total size of memory occupied by free (not in use) chunks.
OUT(keepcost); // This is the size of the top-most releasable chunk that normally borders the end of the heap