Reputation: 11
I am running python program using Linux operating system and i want to know how much total memory used for this process. Is there any way to determine the total memory usage ?
Upvotes: 0
Views: 521
Reputation: 5765
You can use psutil module.
It can be installed with sudo pip install psutil
import os, psutil
process = psutil.Process(os.getpid())
print process.memory_info().rss
This is crossplaform method.
Upvotes: 1
Reputation: 7316
If you are looking for a python way to do it:
import os
# obtain the current process id
pid = str(os.getpid())
# read the process system status
status = os.system('cat /proc/' + pid + '/status')
print status
Upvotes: 2
Reputation: 1121
You can just open task manager and look how much ram does it take. I use Ubuntu and it came preinstalled.
Upvotes: 0