Skip to content

Guard snap_pour_point_d8() against unbounded memory allocations (#1362)#1366

Merged
brendancol merged 1 commit into
mainfrom
issue-1362
Apr 29, 2026
Merged

Guard snap_pour_point_d8() against unbounded memory allocations (#1362)#1366
brendancol merged 1 commit into
mainfrom
issue-1362

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1362.

Summary

Test plan

  • pytest xrspatial/hydro/tests/test_snap_pour_point_d8.py -- 27 passed (5 new memory-guard tests under TestMemoryGuard)
  • Full hydro suite: 731 passed, 2 deselected (known flakes test_basin_dask_temp_cleanup, test_stream_link_dask_temp_cleanup)

The numpy and cupy dispatches each allocate three full H*W float64
buffers (flow_accum cast, pour_points cast, output) -- ~24 B/px with no
memory check. Add per-module _check_memory and _check_gpu_memory helpers
modeled on flow_accumulation_d8 (#1318/#1319), wired into the public
dispatch before the eager allocations. Dask paths use windowed slicing
and skip the guard.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Apr 29, 2026
@brendancol brendancol merged commit 054f7c4 into main Apr 29, 2026
11 checks passed
@brendancol brendancol deleted the issue-1362 branch May 5, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

snap_pour_point_d8: no memory guard on H*W working arrays

1 participant