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

Function test_table_uses_memory_pool

python/pyarrow/tests/test_pandas.py:3963–3982  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3961
3962
3963def test_table_uses_memory_pool():
3964 N = 10000
3965 arr = pa.array(np.arange(N, dtype=np.int64))
3966 t = pa.table([arr, arr, arr], ['f0', 'f1', 'f2'])
3967
3968 gc.collect()
3969 prior_allocation = pa.total_allocated_bytes()
3970 x = t.to_pandas()
3971
3972 new_allocation = 3 * N * 8
3973 if _pandas_api.uses_string_dtype():
3974 # for the small columns Index
3975 new_allocation += 128
3976
3977 assert pa.total_allocated_bytes() == (prior_allocation + new_allocation)
3978
3979 # Check successful garbage collection
3980 x = None # noqa
3981 gc.collect()
3982 assert pa.total_allocated_bytes() == prior_allocation
3983
3984
3985def test_object_leak_in_numpy_array():

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected