Troubleshooting High Memory (RAM) Usage
Running out of memory can cause services to crash. Use these commands to diagnose.
Using `free`
The `free -h` command gives a quick, human-readable overview of your total, used, and free memory.
Using `htop`
Run `htop` and sort by memory usage by pressing `F6` and selecting `PERCENT_MEM`. This will show you exactly which processes are consuming the most RAM.
Finding Memory Leaks
A memory leak is when a program consumes more and more memory over time without releasing it. If you identify a process in `htop` that is constantly growing in memory usage, it may have a leak. Restarting the service is a temporary fix, but the application code may need to be debugged.