0

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 ?

1

3 Answers 3

2

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
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

You can just open task manager and look how much ram does it take. I use Ubuntu and it came preinstalled.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.