GithubHelp home page GithubHelp logo

julman99 / eatmemory Goto Github PK

View Code? Open in Web Editor NEW
140.0 4.0 34.0 67 KB

Simple C program to allocate memory from the command-line. Useful to test programs or systems under high memory usage conditions

License: MIT License

Makefile 1.62% C 96.57% Dockerfile 1.12% Shell 0.68%

eatmemory's Introduction

eatmemory

1. Introduction

Simple utility to allocate memory on a computer

2. What can I use this for?

  • Test swap
  • Test behaviors on a machine when there is little memory available

3. Installation

Compile from sources

cd /tmp
git clone https://github.com/julman99/eatmemory.git
cd eatmemory
sudo make install

MacOS Homebrew

brew tap julman99/toolbox
brew install eatmemory

Using Docker

See section 5

4. Running

eatmemory <size>

Size is in number of bytes, megabytes or gigabytes.

Examples

eatmemory 1024
eatmemory 10M
eatmemory 4G

5. Docker image

Running a container to eat 128MB:

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

Building the container

You need at least Docker 17.05 to use the multi-stage build feature

$ docker build . -t eatmemory

6. Support this project

Bitcoin Address: 14LFRrMX3HmyAH9zQsnzYoVKDH6bVWiBu3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.