Skip to content

Measure peak memory pressure of a Python Polars LazyFrame

Executes the lazy query (streaming engine by default) and reports the increase in peak process RSS (resident set size) caused by the execution, in bytes. The measurement runs in-process via resource.getrusage(), so it reflects the combined R + Python peak memory. Use together with [show_lazy_graph()(show_lazy_graph/) to see which parts of the plan drive memory.

measure_lazy_memory(lf_py, ...)
Argument Description
lf_py A Python Polars LazyFrame.
... Additional arguments passed to LazyFrame$collect().

Peak memory increase in bytes (a positive double).