https://github.com/texadactyl/rampig.c
Allocation requested RAM and sleep
https://github.com/texadactyl/rampig.c
Last synced: about 2 months ago
JSON representation
Allocation requested RAM and sleep
- Host: GitHub
- URL: https://github.com/texadactyl/rampig.c
- Owner: texadactyl
- License: gpl-3.0
- Created: 2021-06-12T16:53:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-04T18:00:53.000Z (over 3 years ago)
- Last Synced: 2025-02-09T23:29:30.413Z (3 months ago)
- Language: C
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rampig
Allocate the requested RAM from the heap and sleep until a signal is received. Then, give it back and exit to the O/S.One parameter is required: the amount of memory is expressed in Megabytes (MB).
_NOTE: This program runs only on POSIX systems i.e. Linux, Unix, and MacOS (probably)._
### Build Dependencies
- `gcc`
- MacOS: Xcode? Sorry, I am not a Mac user.
- Windows: Probably not applicable. I am not a Windows user.### Build
`make`
### Command Line Execution
`rampig {N}` # where `{N}` = the number of megabytes to allocate from the heap.
If you want rampig to run in background, use the usual ampersand (&) at the end of the command line.
### Termination in Forground
Ctrl-C (same as `kill -2`)
Then, you will see the following message followed by program exit to the O/S:
`rampig: Caught signal 2.`### Termination in Background
When `rampig` starts, it announces its process identifier (pid) like this:
`rampig: Hello, my process ID = 42.`So, to force that particular process to exit, do this:
`kill 42`Another method of killing rampig in background: `killall rampig`
Then, you will see the following message followed by program exit to the O/S:
`rampig: Caught signal 15.`### Sample Foreground Execution Stdout
`rampig 2000`
```
rampig: Hello, my process ID = 100694.
rampig: Allocating 2000 MB of RAM
rampig: Allocated & intialised 2000000000 bytes.
^C (Ctrl-C)
rampig: Caught signal 2.
rampig: Deallocating 2000 MB of RAM
```