From 9e7f9a10c4cf080242c210eadb86e5e278b7243f Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Tue, 26 May 2026 22:15:48 +0200 Subject: [PATCH 1/2] Add gc.collect() --- python/pyarrow/tests/test_pandas.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/pyarrow/tests/test_pandas.py b/python/pyarrow/tests/test_pandas.py index 4c8e6f82594..596ef7117d4 100644 --- a/python/pyarrow/tests/test_pandas.py +++ b/python/pyarrow/tests/test_pandas.py @@ -3966,6 +3966,7 @@ def test_table_uses_memory_pool(): arr = pa.array(np.arange(N, dtype=np.int64)) t = pa.table([arr, arr, arr], ['f0', 'f1', 'f2']) + gc.collect() prior_allocation = pa.total_allocated_bytes() x = t.to_pandas() From 3f56ab56f4dce8cb7535f1766fdc97bacb2ea82e Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Thu, 28 May 2026 19:40:17 +0200 Subject: [PATCH 2/2] Add gc.collect to _check_to_pandas_memory_unchanged --- python/pyarrow/tests/test_pandas.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/pyarrow/tests/test_pandas.py b/python/pyarrow/tests/test_pandas.py index 596ef7117d4..326473b1093 100644 --- a/python/pyarrow/tests/test_pandas.py +++ b/python/pyarrow/tests/test_pandas.py @@ -3901,6 +3901,7 @@ def test_singleton_blocks_zero_copy(): def _check_to_pandas_memory_unchanged(obj, **kwargs): + gc.collect() prior_allocation = pa.total_allocated_bytes() x = obj.to_pandas(**kwargs) # noqa