MCPcopy Create free account
hub / github.com/apache/datafusion / split

Method split

datafusion/execution/src/memory_pool/mod.rs:487–499  ·  view source on GitHub ↗

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`]

(&self, capacity: usize)

Source from the content-addressed store, hash-verified

485 ///
486 /// Panics if `capacity` exceeds [`Self::size`]
487 pub fn split(&self, capacity: usize) -> MemoryReservation {
488 self.size
489 .fetch_update(
490 atomic::Ordering::Relaxed,
491 atomic::Ordering::Relaxed,
492 |prev| prev.checked_sub(capacity),
493 )
494 .unwrap();
495 Self {
496 size: atomic::AtomicUsize::new(capacity),
497 registration: Arc::clone(&self.registration),
498 }
499 }
500
501 /// Returns a new empty [`MemoryReservation`] with the same [`MemoryConsumer`]
502 pub fn new_empty(&self) -> Self {

Callers 15

from_dir_nameMethod · 0.45
plan_builder_unnestFunction · 0.45
get_spansFunction · 0.45
split_up_extra_infoMethod · 0.45
in_mem_sort_streamMethod · 0.45
get_tpch_query_sqlFunction · 0.45
extract_function_nameFunction · 0.45
str_to_map_implFunction · 0.45
query_valueMethod · 0.45
criterion_benchmarkFunction · 0.45

Calls 1

newFunction · 0.85

Tested by 11

plan_builder_unnestFunction · 0.36
get_spansFunction · 0.36
get_tpch_query_sqlFunction · 0.36
extract_function_nameFunction · 0.36
regression_testFunction · 0.36
format_linesFunction · 0.36
format_linesFunction · 0.36
clickbench_queriesFunction · 0.36
test_async_udf_metricsFunction · 0.36
test_struct_nullsFunction · 0.36
test_splitFunction · 0.36