1

I'm aware we can use something like this:

import psutil

process = psutil.Process(os.getpid())
mem_info = process.memory_info()
print(f'shap: {i} ---> {mem_info.rss},{mem_info.vms}')

I suspect the app is leaking memory. Is it a bad idea to measure memory usage from the app itself? I maybe overthinking this, but wondering if psutil library itself may skew the numbers?

I was thinking it's more reliable to measure memory from the OS. Using debian so maybe monitor memory with top ?

user219820
  • 113
  • 2
  • 10
  • Does this answer your question? https://stackoverflow.com/a/68731817/15964568 – ToTamire Aug 29 '21 at 15:59
  • Not really. I'm asking if memory usage should be measured by the OS, and not a python library. – user219820 Aug 29 '21 at 16:24
  • Based on my knowledge about this library, it measure memory usage using OS libraries and commands. This library measue mrmory every line so you can try to find what cause the problem. – ToTamire Aug 30 '21 at 17:13

0 Answers0