How to find the memory usage programatically?
I want to find what is the memory usage my application
eg. myapp.exe is the output of myapp.cpp.
when the exe is running it has to print current memory usages at certain execution point.
//myapp.cpp
#iclude <iostream.h>
long getMemStatus()
{
//this method has to find what is the size of memory usage in its current process space
}
void main ()
{
cout<<"\n1. current mem usage:"<<getMemstaus();
int *i=new int;
cout<<"\n2. current mem usage:"<<getMemstaus();
int x=10;
cout<<"\n3. current mem usage:"<<getMemstaus();
delete i;
cout<<"\n4. current mem usage:"<<getMemstaus();
}
can somebody write the code for the function above getMemStatus()?
Also how to find what is heap mem size, stack mem size for my process programatically?

