Skip to content

drnhhl/py_limit_memory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py_limit_memory

constrain/limit the memory (RAM) of a process in python for a function via a function decorator on linux

Install

first clone or download the repo and use pip to install

git clone https://github.com/drnhhl/py_limit_memory
cd py_limit_memory
pip install .

Usage

from py_limit_memory import limit_memory

@limit_memory("10GB") # limit to 10GB
def function_to_limit():
    pass

# or

@limit_memory("10%") # limit to 10% of the total RAM
def function_to_limit():
    pass

Credit

code adapted from: stackoverflow

About

constrain and limit the memory (RAM) of a process in python via a function decorator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages