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

Function test_split

datafusion/execution/src/memory_pool/mod.rs:565–583  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

563
564 #[test]
565 fn test_split() {
566 let pool = Arc::new(GreedyMemoryPool::new(50)) as _;
567 let r1 = MemoryConsumer::new("r1").register(&pool);
568
569 r1.try_grow(20).unwrap();
570 assert_eq!(r1.size(), 20);
571 assert_eq!(pool.reserved(), 20);
572
573 // take 5 from r1, should still have same reservation split
574 let r2 = r1.split(5);
575 assert_eq!(r1.size(), 15);
576 assert_eq!(r2.size(), 5);
577 assert_eq!(pool.reserved(), 20);
578
579 // dropping r1 frees 15 but retains 5 as they have the same consumer
580 drop(r1);
581 assert_eq!(r2.size(), 5);
582 assert_eq!(pool.reserved(), 5);
583 }
584
585 #[test]
586 fn test_new_empty() {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
registerMethod · 0.45
try_growMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…