Skip to main content

Prevents freezing of your machine when it's running out of RAM

Project description

Out Of Mana Memory

Provides a function that keeps an eye on your RAM and stops executing of the process if you are running out of memory.

Example 1: The simplest

from oom import exit_on_out_of_ram

one_gigabyte = 1 << 30
exit_on_out_of_ram(one_gigabyte)

# explode your RAM
extremely_big_number = 1 << 9999999
_ = [i for i in range(extremely_big_number)]

Example 2: Full

from oom import exit_on_out_of_ram

one_gigabyte = 1 << 30
exit_on_out_of_ram(
    terminate_on=one_gigabyte,
    warn_on = 2 * one_gigabyte,
    sleep_time=1,
    notify_about_using=True
)

# explode your RAM
extremely_big_number = 1 << 9999999
_ = [i for i in range(extremely_big_number)]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for oom, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size oom-0.0.6-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size oom-0.0.6.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page