Skip to content

Instantly share code, notes, and snippets.

@bhuiyanmobasshir94
Created April 12, 2023 18:13
Show Gist options
  • Save bhuiyanmobasshir94/476d9e4901e3becc11753d95f14e6e55 to your computer and use it in GitHub Desktop.
Save bhuiyanmobasshir94/476d9e4901e3becc11753d95f14e6e55 to your computer and use it in GitHub Desktop.
import psutil
# Get the current memory usage of the server
mem = psutil.virtual_memory()
# Print the current memory usage
print(f"Current Memory Usage: {mem.used} bytes")
# Increase the memory by 2 GB
new_mem = mem.total + 2 * 1024 * 1024 * 1024
# Set the new memory value
psutil.virtual_memory().total = new_mem
# Print the new memory value
print(f"New Memory Value: {new_mem} bytes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment