Skip to main content

Module scoped_memory_pool

Module scoped_memory_pool 

Source
Expand description

Per-query MemoryPool wrapper that adds accounting on top of a shared pool Per-query [datafusion::execution::memory_pool::MemoryPool] wrapper that adds accounting on top of a shared pool.

ScopedMemoryPool delegates every operation to the wrapped inner pool, so the budget, spilling behavior, and top-consumer reporting (when inner is a TrackConsumersPool) stay exactly as they were. The only thing it adds is its own current/peak counters, which track just the reservations that were grown through this particular instance. Because a MemoryReservation is permanently bound to the Arc<dyn MemoryPool> it registered with (see MemoryConsumer::register), wrapping the shared pool once per query and handing that wrapper to the query’s RuntimeEnv is enough to isolate one query’s peak from another’s, with no ambient context or naming scheme involved.

Structs§

ScopedMemoryPool
A [MemoryPool] that forwards every call to inner, while separately tracking the current and peak (high-water mark) reservation grown through this instance alone.