Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, psutil
- def get_allocated_megabytes_per_app():
- pid_of_app = os.getpid()
- app_process = psutil.Process(pid_of_app)
- allocated_bytes = app_process.memory_info().rss
- allocated_megabytes = allocated_bytes / 1_000_000
- allocated_megabytes = round(allocated_megabytes, 3)
- return allocated_megabytes
- class Test:
- @staticmethod
- def static():
- lst_2 = ["Hello world"*10000 for x in range(10000)]
- Test.static()
- print(get_allocated_megabytes_per_app())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement