Skip to content

Instantly share code, notes, and snippets.

@dtkav
Created February 25, 2019 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtkav/0ce6d7b8e5707a89c1386470f8604fbe to your computer and use it in GitHub Desktop.
Save dtkav/0ce6d7b8e5707a89c1386470f8604fbe to your computer and use it in GitHub Desktop.
firefox, but in a memory limited cgroup
#!/bin/bash
# create memory limited cgroup
sudo cgcreate -g memory:firefox
echo "5G" | sudo tee -a /sys/fs/cgroup/memory/firefox/memory.limit_in_bytes
echo "1" | sudo tee -a /sys/fs/cgroup/memory/firefox/memory.swappiness
# move shell to cgroup
echo $$ | sudo tee /sys/fs/cgroup/memory/firefox/tasks
# start firefox
nohup firefox &
disown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment