Memory usage of current process in C
You can always just open the 'files' in the /proc
system as you would a regular file (using the 'self' symlink so you don't have to look up your own pid):
FILE* status = fopen( "/proc/self/status", "r" );
Of course, you now have to parse the file to pick out the information you need.
How can I find how much memory my application is used any any time in c++
if you want measure how much memory is using via above code at runtime u must calculate this:
(# of element in fileList) * sizeof(string) + size of files in fileList
but if you want get all of your process memory usage in windows at runtime you can call GetProcessMemoryInfo API in your program and pass your process handle(GetCurrentProcess() API) to it,sample usage of this API:
https://msdn.microsoft.com/en-us/library/ms682050.aspx
see complete response to your question via this link:
How to determine CPU and memory consumption from inside a process?
Related Topics
How to Output Coloured Text to a Linux Terminal
Return Statement VS Exit() in Main()
C++ Performance Challenge: Integer to Std::String Conversion
What's the Difference Between _Pretty_Function_, _Function_, _Func_
Why Can't I Initialize Non-Const Static Member or Static Array in Class
Incrementing in C++ - When to Use X++ or ++X
Does It Make Any Sense to Use Inline Keyword With Templates
Detect If Stdin Is a Terminal or Pipe
Why Does C++11 Not Support Designated Initializer Lists as C99
Std::Endl Is of Unknown Type When Overloading Operator≪≪
When Can Outer Braces Be Omitted in an Initializer List
Is There a C Pre-Processor Which Eliminates #Ifdef Blocks Based on Values Defined/Undefined
Why Do Constant Expressions Have an Exclusion For Undefined Behavior
How to Construct a Std::String With Embedded Values, I.E. "String Interpolation"