C++ Program size in Memory

c++, memory, memory-leaks, memory-management

Solution

I dont think there is a mutli-platform way of doing this. But you could use macros to do it like:

#ifdef __GCC__
//linux code
#else 
//windows code
#endif

heres a link for the windows method:

How to get memory usage under Windows in C++

and one for a linux method:

How to get memory usage at run time in c++?

Problem

I'm trying to make a c++ program print out its own memory footprint. Whats a good way to print out the KB of memory a c++ program is using at the current time? I would need it for Linux and windows...so something platform independent.... Thank you, MS

Original source

Related problems