pub struct Reservation { /* private fields */ }Expand description
Memory one operator is holding, given back when this is dropped.
It starts at whatever Memory::reserve was asked for and grows from there, which is the shape
a buffering operator wants: it does not know how much it will hold until it has read its input,
and it wants to be told as soon as the answer is too much rather than after the last row.
Implementations§
Source§impl Reservation
impl Reservation
Sourcepub fn grow(&mut self, bytes: u64) -> Result<()>
pub fn grow(&mut self, bytes: u64) -> Result<()>
Takes another bytes out of the same budget.
§Errors
crate::ErrorCode::OutOfMemory when the limit is set and this would pass it. The
reservation is unchanged in that case and still releases what it already held.
Sourcepub fn shrink(&mut self, bytes: u64)
pub fn shrink(&mut self, bytes: u64)
Gives bytes of it back, or everything if that is more than this is holding.
For an operator that charged several things against one reservation and has dropped one of them. The aggregate charges its hash table, its accumulators and its distinct sets together, and then hands the keys out of the table into the rows it is building, at which point the table is gone and the accumulators are not. Waiting for the whole reservation would charge a table that no longer exists for the whole of the conversion, which is exactly the moment the operator is holding the most.