Created
April 12, 2023 18:13
-
-
Save bhuiyanmobasshir94/476d9e4901e3becc11753d95f14e6e55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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