Simple utility to allocate memory on a computer
- Test swap
- Test behaviors on a machine when there is little memory available
cd /tmp
git clone https://github.com/julman99/eatmemory.git
cd eatmemory
sudo make install
brew tap julman99/toolbox
brew install eatmemory
See section 5
eatmemory <size>
Size is in number of bytes, megabytes or gigabytes.
eatmemory 1024
eatmemory 10M
eatmemory 4G
eatmemory is available in Dockerhub, so you can just run it without going through the build process
$ docker run -d --rm --name hungry_container julman99/eatmemory 128M
Check the memory consumption of the container:
$ docker stats --no-stream=true hungry_container
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
hungry_container 0.00% 133.9 MiB / 3.651 GiB 3.58% 2.01 kB / 1.08 kB 1.217 MB / 3.265 MB 4
You need at least Docker 17.05 to use the multi-stage build feature
$ docker build . -t eatmemory
Bitcoin Address: 14LFRrMX3HmyAH9zQsnzYoVKDH6bVWiBu3