Abstractions for a reason
For local memory allocation Really, you can wrap your free() and malloc() withprogram shouldn't have this as a custom one .concern. It is an OS concern, your problem should just be efficient with what it needs and let the OS do its job. but even then
If you insist, libraries you link may/will bypass that. You could use a debugger to get better information. You can get general statistics by reading something likelook into /proc/meminfo on Linux or using a library like this one.
You could also look into, brk(), getrlimit() and setrlimit() (here are some docs) with the RLIMIT_STACK and RLIMIT_DATA values for approximations and rough-ishes.
#include <sys/resource.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> int main (int argc, char *argv[]) { struct rlimit limit; /* Get the stack limit. */ if (getrlimit(RLIMIT_STACK, &limit) != 0) { printf("getrlimit() failed with errno=%d\n", errno); exit(1); } printf("The stack soft limit is %llu\n", limit.rlim_cur); printf("The stack hard limit is %llu\n", limit.rlim_max); exit(0); } Modified from here also see man getrlimit on your system
If you state what and why you want to do this, someone may have a better method or way of doing what you want.