how to find out the amount of memory used
-
18-06-2021 - |
Question
I am trying out a C/C++ program, I want to know how much memory i am using due to heap and some other data structures. So how can I find out the amount of memory used by my various data structures?
I think that malloc operator should be overridden but I am not sure about the same.
I am working on Linux and on Netbeans 7.1.
OTHER TIPS
If you want to use hand-made memory profiling then you need to overload operator new
and/or malloc()
function. Though malloc()
can be overloaded easily, but you need to use macro tricks.
Advantage of using and overloading operator new
is that, it's easier, elegant and you can evaluate each type of struct
/class
separately.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow