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

Function check_allocated_bytes

python/pyarrow/tests/test_memory.py:62–78  ·  view source on GitHub ↗

Check allocation stats on *pool*.

(pool)

Source from the content-addressed store, hash-verified

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