free_memory_gb()returns the memory available for new processes (MemAvailableof/proc/meminfoon Linux), in gigabytes.check_free_memory()stops when it falls below a minimum. Call it before a heavy step (a large aggregation, an OCR run, a language model): two heavy jobs at once exhaust the machine.
Value
free_memory_gb(): gigabytes (NA where /proc/meminfo does not
exist). check_free_memory(): the available memory, invisibly.
Details
Available memory counts the file cache that the system can release; it is
what a new process can use without swapping. DuckDB's memory limit should
stay well below it (see db_connect()): DuckDB spills to disk beyond its
limit, whereas a process that exceeds the available memory is killed.
See also
Other memory:
db_check_unique(),
db_query_chunks()