bloc.memory#

Process memory measurement helpers.

Used to record how much memory a simulation needed, so that memory is tracked by the non-regression suite alongside wall-clock time (issue #331). Heavy mechanisms dominate memory: one 452-species / 24k-reaction ct.Solution costs roughly 200 MB, and Cantera does not share parsed mechanism data between instances, so the object count – not the numeric payload – sets the footprint.

Functions#

peak_rss_mb()

Return this process's peak resident-set size in MB, or None if unknown.

current_rss_mb()

Return this process's current resident-set size in MB, or None.

Module Contents#

bloc.memory.peak_rss_mb()#

Return this process’s peak resident-set size in MB, or None if unknown.

This is a high-water mark for the whole process since it started: it never decreases, so a value read at the end of a scenario reflects the largest footprint reached up to that point, not that scenario in isolation. That is deliberate – the quantity that kills a CI runner is how close the process ever got to the memory limit.

Returns None on platforms exposing neither resource nor psutil, so callers must treat the measurement as optional.

bloc.memory.current_rss_mb()#

Return this process’s current resident-set size in MB, or None.

Unlike peak_rss_mb() this falls when memory is released, so it is the right choice for observing whether a teardown actually reclaimed anything.