Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get how much memory a program uses?

I have two programs, one in C++, the other in assembler. I want to compare how much memory they use when running respectively. How can I do this?

I am doing the testing on Windows, but I also would like to know how to do it on Linux.

like image 909
user176121 Avatar asked Sep 26 '09 06:09

user176121


People also ask

How much memory is an app using?

Tap Developer options and then tap Memory. In the resulting screen (Figure B), you'll see a list of the average memory used by the device in the past three hours (you can adjust the time frame, by tapping the time drop-down at the top). The Memory usage window in Android 12.

Which command can be used to see how much memory is used by a program?

vmstat Command to Report Virtual Memory Statistics. The vmstat command is a useful tool that reports virtual memory statistics. vmstat provides general information about processes, memory, paging, block IO, traps, and CPU activity.


1 Answers

On Linux, try valgrind. It's an amazing tool with too many features for mere mortals to totally comprehend. Have a look at valgrind's massif.

like image 136
Artelius Avatar answered Oct 04 '22 03:10

Artelius