+ 3

Computing the total memory used in an execution

I was wondering in other programming languages on how to compute the total memory consumed in order for me to understand how big the code consumes in its execution time. In python, it is said that we can use the os module and the psutil module. import os import psutil process = psutil.Process(os.getpid()) print(process.memory_info().rss) I was wondering since python is an interpreter language and it is rather slow in terms of reading the code since it's datatypes aren't specified and I would lile to see if this affects the memory consumed. So I would like to compare it to some languages. Can anybody suggest a code that can get the memory of other programming langauges. Thanks in advance.

24th May 2018, 3:11 AM
Neet
Neet - avatar
4 Respuestas
+ 3
Here is an answer for Java: https://stackoverflow.com/questions/74674/how-to-do-i-check-cpu-and-memory-usage-in-java They have similar answers for C++, which are operating system dependent so you need to decide where you are going to run it first.
24th May 2018, 10:48 PM
John Wells
John Wells - avatar
+ 2
thank you for the effort. I would gladly check this out thanks!
25th May 2018, 1:46 AM
Neet
Neet - avatar
+ 1
Het is an answer for c# it: using System.Diagnostics; //contains process Process currentProcess = System.Diagnostics.Process.GetCurrentProcess(); long totalBytesOfMemoryUsed = currentProcess.WorkingSet64; Funny c# video https://www.youtube.com/watch?v=c1In6NbJt5E&t=154s
25th May 2018, 9:43 PM
sneeze
sneeze - avatar
+ 1
sneeze thanks for the c# code very much appreciated
27th May 2018, 12:50 AM
Neet
Neet - avatar