Find Memory Consumption Of Your Python Program.

 



import psutil



def get_memory_usage():

    process = psutil.Process(os.getpid())

    memory_info = process.memory_info()

   

    print(f"Memory Usage: {memory_info.rss / (1024 ** 2):.2f} MB")



# Call this function in your code to print the memory usage

get_memory_usage()


Comments

Popular posts from this blog

Node Js Terminal Password Input

Express Production Setup - 5 | Handle Invaild Json

Express Production Setup - 2 | Rate Limiting | DDOS