julman99 / eatmemory Goto Github PK
View Code? Open in Web Editor NEWSimple C program to allocate memory from the command-line. Useful to test programs or systems under high memory usage conditions
License: MIT License
Simple C program to allocate memory from the command-line. Useful to test programs or systems under high memory usage conditions
License: MIT License
Hi,
Would it be possible to host a binary docker image on the docker hub?
That would ease the process for people who want to use it.
This is what happens if compiled (gcc8 or xlC) on AIX:
# ./eatmemory 55M
Currently total memory: -4096
Currently avail memory: -4096
..
This also means that memory size cannot be specified as percentage:
# ./eatmemory 30%
Currently total memory: -4096
Currently avail memory: -4096
Eating -1228 bytes in chunks of 1024...
Done, press any key to free the memory
AIX version: 7200-04
Hi,
When I try to run the last example:
$ docker run -d --rm --name hungry_container julman99/eatmemory 128M
Conflicting options: --rm and -d
Do you have the same problem?
Hi,
Would it be possible to go in background mode and do not read the input from the tty?
For the dockerization, it would be better if there is only one process inside that gets killed if it cannot allocate the memory, or being killed by the linux kernel.
Or maybe an argument to like "-d" to go in daemon mode...
Best,
Just a quick question: how do you ensure that the memory is actually allocated in main RAM? What stops the OS from swapping the memory out? Or pushing it to disk as virtual memory?
launched eatmemory 10G
on m1 mac with 16G ram, while monitoring via htop
, memory graph barely changed at all
and MEM column says it ate only 5%
Hi,
I have launched a 128MB container as mentioned in the example, right after starting it, docker stats outputs rightly 133MB used, but after a while, it only shows 3 MB.
Any idea why?
When I enter the container, the VmData of the eatmemory process still shows the right value:
$ grep VmData /proc/10/status
VmData: 135184 kB
https://github.com/julman99/eatmemory/blob/master/eatmemory.c#L85
Even if compiled with -maix64
size
always contains 32bit integer which means one cannot allocate more than 2147483647 bytes. Replacing with atol
solves the issue.
With atoi
(original):
$ ./eatmemory 3000000000000000
Currently total memory: -4096
Currently avail memory: -4096
Eating 2147483647 bytes in chunks of 1024...
With atol
(new):
$ eatmemory 3000000000000000
Currently total memory: -4096
Currently avail memory: -4096
Eating 3000000000000000 bytes in chunks of 1024...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.