Anirudh Sundar
New Member
Hi,
I am running a C++ application on Redhat linux, built using gcc. The program works in a step by step manner, and each steps uses new and delete to allocate and remove memory for huge data structures. I've made sure that we are freeing all the memory allocated, but when I check for the memory used by process, it just keeps increasing.
I read that linux tries to reuse memory given to a process and hence sometimes doesn't reclaim the memory freed by the process. Is this true, and if so, how do I make sure that exactly how much memory my process is using currently, excluding the memory freed but kept by linux.
I'm checking for memory used by process right now in 2 ways. One using top/htop command and other is fetching the data from /proc/*/status file.
Could you let me know how to find the exact amount of memory (only the the amount of memory it holds right now, not the freed memory).
Thanks.
I am running a C++ application on Redhat linux, built using gcc. The program works in a step by step manner, and each steps uses new and delete to allocate and remove memory for huge data structures. I've made sure that we are freeing all the memory allocated, but when I check for the memory used by process, it just keeps increasing.
I read that linux tries to reuse memory given to a process and hence sometimes doesn't reclaim the memory freed by the process. Is this true, and if so, how do I make sure that exactly how much memory my process is using currently, excluding the memory freed but kept by linux.
I'm checking for memory used by process right now in 2 ways. One using top/htop command and other is fetching the data from /proc/*/status file.
Could you let me know how to find the exact amount of memory (only the the amount of memory it holds right now, not the freed memory).
Thanks.