From 2c26265753a5dc3f75561fd93747ad933e57b947 Mon Sep 17 00:00:00 2001 From: Brendan Collins Date: Wed, 13 May 2026 08:13:42 -0700 Subject: [PATCH] fix(test): avoid 4 GB list allocation in BigTIFF threshold test test_large_strip_table_alone_can_promote built a tag list with ``[0] * (UINT32_MAX // 8 + 1)``, allocating roughly 4 GB before ``_compute_classic_ifd_overhead`` was even called. On GitHub-hosted ubuntu runners (~7 GB RAM) this OOM-killed the pytest worker with exit code 143, which fail-fast then cancelled the whole pytest job on main. Drive the same "huge strip table alone forces BigTIFF" assertion through the ``n_entries`` parameter of ``_should_use_bigtiff_streaming`` (8 bytes per entry, no list allocation). The ``_compute_classic_ifd_overhead`` wiring is already exercised by ``test_overhead_pushes_just_under_threshold_over`` and ``test_large_gdal_metadata_flips_decision``. --- ...st_geotiff_streaming_bigtiff_threshold_1785.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xrspatial/tests/test_geotiff_streaming_bigtiff_threshold_1785.py b/xrspatial/tests/test_geotiff_streaming_bigtiff_threshold_1785.py index 24d1638f..d960d299 100644 --- a/xrspatial/tests/test_geotiff_streaming_bigtiff_threshold_1785.py +++ b/xrspatial/tests/test_geotiff_streaming_bigtiff_threshold_1785.py @@ -141,17 +141,18 @@ def test_small_raster_no_overhead_stays_classic(self): def test_large_strip_table_alone_can_promote(self): """Even a small pixel payload can need BigTIFF if n_entries is huge. - This documents the strip-table contribution: ~536 M entries puts - the table itself near 4 GiB. Not realistic in practice, but it - proves the overhead is wired through. + Documents the strip-table contribution: ~536 M entries puts the + table itself near 4 GiB and forces BigTIFF with no pixel data. + Driven through the ``n_entries`` parameter (8 bytes per entry) + to avoid allocating a 536 M-element Python list at test time; + the ``ifd_overhead_bytes`` path is exercised by + ``test_overhead_pushes_just_under_threshold_over``. """ n_entries = (UINT32_MAX // 8) + 1 - tags = _minimal_tag_list(n_entries=n_entries) - overhead = _compute_classic_ifd_overhead(tags) assert _should_use_bigtiff_streaming( uncompressed_bytes=0, - n_entries=0, - ifd_overhead_bytes=overhead, + n_entries=n_entries, + ifd_overhead_bytes=0, ) is True def test_overhead_pushes_just_under_threshold_over(self):