Skip to content

Commit

Permalink
Optionally check NRT allocations (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjperkins authored May 25, 2023
1 parent e6a0f16 commit 967c779
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ History

X.Y.Z (YYYY-MM-DD)
------------------
* Optionally check NRT allocations (:pr:`286`)
* Use `packaging.version.Version` instead of deprecated `distutils.version.LooseVersion` (:pr:`285`)
* Pin numba to less than 0.59 in anticipation of @generated_jit deprecation (:pr:`284`)
* Update trove hash (:pr:`279`)
Expand Down
17 changes: 1 addition & 16 deletions africanus/averaging/tests/test_bda_averaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,23 +368,8 @@ def test_dask_bda_avg(vis_format):
raise ValueError(f"Invalid vis_format: {vis_format}")


@pytest.fixture
def check_leaks():
import gc
from numba.core.runtime import rtsys

try:
yield None
finally:
gc.collect()

stats = rtsys.get_allocation_stats()
assert stats.alloc == stats.free
assert stats.mi_alloc == stats.mi_free


@pytest.mark.parametrize("dtype", [np.complex64])
def test_bda_output_arrays(dtype, check_leaks):
def test_bda_output_arrays(dtype):
from africanus.averaging.bda_avg import vis_output_arrays
from numba import njit

Expand Down
3 changes: 2 additions & 1 deletion africanus/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-

import numba
from numba.core.runtime import rtsys
import pytest

from africanus.util.testing import mark_in_pytest


@pytest.fixture(scope="function", autouse=True)
@pytest.fixture(scope="function", autouse=bool(numba.config.NRT_STATS))
def check_allocations():
""" Check allocations match frees """
try:
Expand Down

0 comments on commit 967c779

Please sign in to comment.