Skip to content

A cross-platform C utility for stress testing and analyzing system memory by allocating user-configurable chunks until exhaustion or set limits, featuring adjustable speed modes, real-time progress tracking, error handling, and graceful shutdown for resource evaluation.

License

Notifications You must be signed in to change notification settings

elxecutor/ram-hog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

RAM Hog

A cross-platform memory allocation utility written in C that allocates memory in fixed-size chunks until either memory is exhausted or a configurable maximum limit is reached. Perfect for stress testing, memory analysis, and system resource evaluation.

Table of Contents

Features

  • Configurable chunk allocation: Set custom chunk sizes (default: 100MB)
  • Memory limit control: Set maximum allocation limits with MB/GB unit support
  • Speed modes: Choose between aggressive (fast) or gentle (delayed) allocation
  • Progress tracking: Real-time logging of allocation progress
  • Graceful shutdown: Clean memory release on Ctrl+C interruption
  • Cross-platform: Compatible with Windows, Linux, and macOS
  • Error handling: Robust malloc failure detection and recovery
  • Memory persistence: Holds allocated memory indefinitely until termination

Installation

Clone the repository and compile the program:

git clone https://github.com/elxecutor/ram-hog.git
cd ram-hog
gcc -O2 ramhog.c -o ramhog

Usage

  1. Basic usage (allocate 100MB chunks until memory exhausted):

    ./ramhog
  2. Custom chunk size (50MB chunks):

    ./ramhog -c 50
  3. Set allocation limit (allocate up to 2GB):

    ./ramhog -m 2G
  4. Gentle allocation mode (100ms delay between chunks):

    ./ramhog -s gentle
  5. Combined options:

    ./ramhog -c 25 -m 1G -s aggressive
  6. View help:

    ./ramhog --help

Command Line Options

  • -c, --chunk-size SIZE: Chunk size in MB (default: 100)
  • -m, --max-alloc SIZE: Maximum allocation (MB/GB, 0=unlimited, default: 0)
  • -s, --speed MODE: Allocation speed: aggressive or gentle (default: aggressive)
  • -h, --help: Show help message

Size Format Examples

  • 100 - 100 MB
  • 2G - 2 GB
  • 1024M - 1024 MB

Contributing

We welcome contributions! Please see our Contributing Guidelines and Code of Conduct for details.

License

This project is licensed under the MIT License.

Contact

For questions or support, please open an issue or contact the maintainer via X.

About

A cross-platform C utility for stress testing and analyzing system memory by allocating user-configurable chunks until exhaustion or set limits, featuring adjustable speed modes, real-time progress tracking, error handling, and graceful shutdown for resource evaluation.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages