available_memory

function of dascore.utils.misc source

available_memory()-> ‘int | None’

Bytes an array read into memory could use, or None if unknowable.

What the system reports free, less some headroom, so that a read which will not fit is refused before it starts rather than failing part way. Asking needs psutil, which is not a dependency; without it there is no figure and nothing is refused.

Examples

from dascore.utils.misc import available_memory
budget = available_memory()
assert budget is None or budget > 0