Skip to content

Commit 54f8cf9

Browse files
authored
GH-44728: [Python] Trigger manual Garbage collection before checking allocated bytes for dlpack tests (#44793)
### Rationale for this change test_dlpack started failing for several jobs on CI due to our tests deallocating memory: ``` allocated_bytes = pa.total_allocated_bytes() try: return f(*args, **kwargs) finally: > assert pa.total_allocated_bytes() == allocated_bytes E assert 3728 == 7440 ``` ### What changes are included in this PR? Trigger a `gc.collect` before checking initial allocated bytes. ### Are these changes tested? Yes via CI ### Are there any user-facing changes? No * GitHub Issue: #44728 Authored-by: Raúl Cumplido <[email protected]> Signed-off-by: Raúl Cumplido <[email protected]>
1 parent 9015a81 commit 54f8cf9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎python/pyarrow/tests/test_dlpack.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import ctypes
1919
from functools import wraps
20+
import gc
2021
import pytest
2122

2223
try:
@@ -50,6 +51,7 @@ def check_dlpack_export(arr, expected_arr):
5051
def check_bytes_allocated(f):
5152
@wraps(f)
5253
def wrapper(*args, **kwargs):
54+
gc.collect()
5355
allocated_bytes = pa.total_allocated_bytes()
5456
try:
5557
return f(*args, **kwargs)

0 commit comments

Comments
 (0)