dextero / oomalloc

A library meant for testing application behavior in out-of-memory conditions with the use of LD_PRELOAD trick.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OOMalloc

A library meant for testing application behavior in out-of-memory conditions with the use of LD_PRELOAD trick.

Requirements

  • Linux
  • glibc - the library contains some glibc-specific code. It will probably not work with alternative libc implementations.

Compiling

cmake . && make

Usage

# enable allocation logs
OOMALLOC_LOG=1 LD_PRELOAD=liboomalloc.so ./your-application

# make the 11th allocation return NULL
OOMALLOC_FAIL_AFTER=10 LD_PRELOAD=liboomalloc.so ./your-application

# make malloc/calloc/realloc fail when heap allocations exceed 10000 bytes
OOMALLOC_LIMIT_HEAP=10000 LD_PRELOAD=liboomalloc.so ./your-application

Acknowledgements

Special thanks to Mateusz Krawiec and Mateusz Kwiatkowski for pointing out issues with the library.

About

A library meant for testing application behavior in out-of-memory conditions with the use of LD_PRELOAD trick.

License:MIT License


Languages

Language:C 65.1%Language:C++ 23.7%Language:CMake 11.2%