A simple Linux RAM filler utility for testing memory pressure using tmpfs.
This script allows you to simulate RAM pressure by filling a temporary filesystem (tmpfs) with zeroed or random data. Useful for:
- Stress testing systems under memory load
- Observing behavior under RAM exhaustion
- Simulating production environments with limited free memory
- Uses
tmpfsunder/tmp/ramfillfor safety (RAM-only, not disk) - Reads config from
~/.config/ramfill.conf - Fill using
/dev/zero(default) or/dev/urandom - CLI with
start,stop, andrestart - Reports memory usage and what will be freed on stop
- Copy
ramfill.shto a directory in your$PATH, e.g.,~/bin - Make it executable:
chmod +x ~/bin/ramfill.sh- Create a config file at
~/.config/ramfill.conf:
# ~/.config/ramfill.conf
RAM_FILL_SIZE="2G"
FILL_SOURCE="zero" # or "urandom"ramfill.sh start # Mounts tmpfs and fills it
ramfill.sh stop # Unmounts tmpfs and frees memory
ramfill.sh restart # Stops and then starts again- Requires
sudofor mounting tmpfs - Only uses RAM, no risk to disk
- Don't use
urandomunless you specifically need entropy-based fill
MIT