MCPcopy Create free account
hub / github.com/apache/arrow / check_allocated_bytes

Function check_allocated_bytes

python/pyarrow/tests/test_memory.py:63–79  ·  view source on GitHub ↗

Check allocation stats on *pool*.

(pool)

Source from the content-addressed store, hash-verified

61
62
63def check_allocated_bytes(pool):
64 """
65 Check allocation stats on *pool*.
66 """
67 allocated_before = pool.bytes_allocated()
68 max_mem_before = pool.max_memory()
69 num_allocations_before = pool.num_allocations()
70 with allocate_bytes(pool, 512):
71 assert pool.bytes_allocated() == allocated_before + 512
72 new_max_memory = pool.max_memory()
73 assert pool.max_memory() >= max_mem_before
74 num_allocations_after = pool.num_allocations()
75 assert num_allocations_after > num_allocations_before
76 assert num_allocations_after < num_allocations_before + 5
77 assert pool.bytes_allocated() == allocated_before
78 assert pool.max_memory() == new_max_memory
79 assert pool.num_allocations() == num_allocations_after
80
81
82def test_default_allocated_bytes():

Callers 3

test_proxy_memory_poolFunction · 0.85
test_logging_memory_poolFunction · 0.85

Calls 4

allocate_bytesFunction · 0.85
bytes_allocatedMethod · 0.45
max_memoryMethod · 0.45
num_allocationsMethod · 0.45

Tested by

no test coverage detected