Struct datafusion::execution::memory_pool::MemoryReservation
source · pub struct MemoryReservation { /* private fields */ }
Expand description
A MemoryReservation
tracks an individual reservation of a
number of bytes of memory in a MemoryPool
that is freed back
to the pool on drop.
The reservation can be grown or shrunk over time.
Implementations§
source§impl MemoryReservation
impl MemoryReservation
sourcepub fn free(&mut self) -> usize
pub fn free(&mut self) -> usize
Frees all bytes from this reservation back to the underlying pool, returning the number of bytes freed.
sourcepub fn try_resize(&mut self, capacity: usize) -> Result<(), DataFusionError>
pub fn try_resize(&mut self, capacity: usize) -> Result<(), DataFusionError>
Try to set the size of this reservation to capacity
sourcepub fn grow(&mut self, capacity: usize)
pub fn grow(&mut self, capacity: usize)
Increase the size of this reservation by capacity
bytes
sourcepub fn try_grow(&mut self, capacity: usize) -> Result<(), DataFusionError>
pub fn try_grow(&mut self, capacity: usize) -> Result<(), DataFusionError>
Try to increase the size of this reservation by capacity
bytes, returning error if there is insufficient capacity left
in the pool.
sourcepub fn split(&mut self, capacity: usize) -> MemoryReservation
pub fn split(&mut self, capacity: usize) -> MemoryReservation
Splits off capacity
bytes from this MemoryReservation
into a new MemoryReservation
with the same
MemoryConsumer
.
This can be useful to free part of this reservation with RAAI style dropping
Panics
Panics if capacity
exceeds Self::size
sourcepub fn new_empty(&self) -> MemoryReservation
pub fn new_empty(&self) -> MemoryReservation
Returns a new empty MemoryReservation
with the same MemoryConsumer
sourcepub fn take(&mut self) -> MemoryReservation
pub fn take(&mut self) -> MemoryReservation
Splits off all the bytes from this MemoryReservation
into
a new MemoryReservation
with the same MemoryConsumer