Skip to content

Fix adaptive resource bind lifetimes - #136

Open
stefanmaierhofer wants to merge 1 commit into
masterfrom
fix/adaptive-bind-lifecycle
Open

Fix adaptive resource bind lifetimes#136
stefanmaierhofer wants to merge 1 commit into
masterfrom
fix/adaptive-bind-lifecycle

Conversation

@stefanmaierhofer

Copy link
Copy Markdown
Member

Fixes #134

Summary

  • Retain one acquired reference to the selected adaptive resource until the binding's final Release or ReleaseAll, while balancing every outer input acquisition.
  • Acquire and evaluate replacement branches before publication, serialize lifecycle transitions, and recover cleanly from mapping, acquisition, evaluation, retirement, and notification failures.
  • Preserve render-token propagation, shallow input equality, unchanged-branch reuse, dependency-edge ownership, and the allocation-free steady-state GetValue path.
  • Cover bind, bind2, and bind3 with backend-independent ownership, switching, exception, reentrancy, and concurrency regressions; clarify the public lifecycle documentation.

Validation

  • 23 focused adaptive-resource tests passed, including repeated concurrency runs.
  • Complete non-Windows Debug and Release builds passed with no warnings or errors.
  • Paired warmed Release benchmarks (median of five processes):
Workload Before After Change Allocation
Steady-state GetValue 25.710 ns 26.392 ns +2.65% 0 B -> 0 B
Acquire/materialize/release 510.222 ns 495.364 ns -2.91% 464 B -> 464 B
Changed-inner switch 751.808 ns 787.337 ns +4.73% 928 B -> 928 B
Unchanged-inner switch 509.334 ns 470.974 ns -7.53% ~472 B -> 464 B

The common paths remain neutral within run-to-run variation, and steady-state reads remain allocation-free.

Track outer binding acquisitions while retaining one acquired reference to the selected mapped resource until the final release. Serialize evaluation, switching, and cleanup so failures cannot publish unacquired resources or double-release retained resources, while keeping bind2 and bind3 input ownership balanced.

Add backend-independent lifecycle and concurrency regressions and document the clarified ownership semantics.

Fixes #134
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep bound adaptive resources alive until their final release

1 participant