Created
December 7, 2016 19:46
-
-
Save omikun/557a996978146eba7a484cdfcb4613ab to your computer and use it in GitHub Desktop.
limits the maximum memory used by process (ls in example) to 10MB
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
# Create a memory cgroup named 'mygroup', allowing $USER to change the parameters and run tasks in the cgroup. | |
sudo cgcreate -a $USER -t $USER -g memory:mygroup | |
# Set the memory limit to 10MB | |
echo 10000000 > /sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes | |
# Run a program in the cgroup | |
cgexec -g memory:mygroup ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment