Requesting more memory (beta)

Modal jobs are guaranteed 256MB of memory by default. However, if there is free memory on a worker, containers can go above that limit at their own risk. This might increase the risk of getting killed because the container runs out of memory.

If you have code that needs more memory than this, you can request it using the memory argument. This expects an integer number of megabytes:

import modal

stub = modal.Stub()

def my_function():
    # code here will have access to 2048MB, at least

How much memory can I request?

Memory requests are a beta feature. Right now, if you request a lot of memory (roughly 16GB or more), your request will be rejected with an InvalidError. We are planning to support very large memory requests in the future (TBs).