A lightweight tool to guard your memory usage.
Ram Guard is a lightweight, utility tool for managing memory usage on your system. It helps prevent running out of memory by listening for user-defined intervals and thresholds; if memory usage exceeds the threshold, Ram Guard finds the most resource-hungry process and stops it in its tracks.
Clone the repository:
git clone https://github.com/owbird/ram-guard.git
cd ram-guard
Install dependencies:
go mod tidy
Run Ram Guard:
go run .
Configure interval
and threshold
as command-line arguments or use defaults of 70% and 5s:
ram-guard --interval <time_in_seconds> --threshold <RAM_limit_in_%>
To set Ram Guard to check every 10 seconds and act if RAM usage exceeds 80%:
ram-guard --interval 10 --threshold 80
Use Ram Guard cautiously, as it automagically terminates high-memory processes. Avoid setting the threshold too low, which could inadvertently stop essential services.
Contributions are welcome! If you’d like to contribute, please open an issue or submit a pull request with suggested changes.