MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_reallocate_with_pool

Function test_reallocate_with_pool

arrow-buffer/src/buffer/mutable.rs:1439–1461  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1437
1438 #[test]
1439 fn test_reallocate_with_pool() {
1440 let pool = TrackingMemoryPool::default();
1441 let mut buffer = MutableBuffer::with_capacity(100);
1442 buffer.claim(&pool);
1443
1444 // Initial capacity should be 128 (multiple of 64)
1445 assert_eq!(buffer.capacity(), 128);
1446 assert_eq!(pool.used(), 128);
1447
1448 // Reallocate to a larger size
1449 buffer.reallocate(200);
1450
1451 // The capacity is exactly the requested size, not rounded up
1452 assert_eq!(buffer.capacity(), 200);
1453 assert_eq!(pool.used(), 200);
1454
1455 // Reallocate to a smaller size
1456 buffer.reallocate(50);
1457
1458 // The capacity is exactly the requested size, not rounded up
1459 assert_eq!(buffer.capacity(), 50);
1460 assert_eq!(pool.used(), 50);
1461 }
1462
1463 #[test]
1464 fn test_truncate_with_pool() {

Callers

nothing calls this directly

Calls 3

defaultFunction · 0.85
reallocateMethod · 0.80
claimMethod · 0.45

Tested by

no test coverage detected