+ 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.
4 Respostas
+ 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.
+ 2
thank you for the effort. I would gladly check this out thanks!
+ 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
+ 1
sneeze thanks for the c# code very much appreciated