Repository navigation
Conversation
ResourceTable kept an entry for every handle given to or lent to the guest, so a long-lived sandbox that passed resources grew without bound. Entries now live in a dictionary keyed by an increasing counter. Take, the end of a loan and an undone gift remove them. Handles are still never reused. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
ludfjig
requested review from
danbugs,
dblnz,
devigned and
jsturtevant
as code owners
November 24, 2026 20:02
ludfjig
requested review from
andreiltd,
jprendes,
simongdavies,
squillace and
syntactically
as code owners
November 24, 2026 20:02
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the C# resource-table cleanup change.
No open issues 🎉
What changed in this PR
This PR addresses #2056 by removing released entries from Hyperlight’s C# resource table, preventing entry accumulation across calls in long-lived sandboxes.
Changes:
- A dictionary stores resources under increasing handles that are never reused.
- Ownership returns, completed loans, and gift rollback remove entries.
- Runtime tests cover cleanup, loan ownership checks, stale handles, and handle non-reuse.
| File | Description |
|---|---|
src/tests/csharp_host/RuntimeTests.cs |
Verifies entry removal and handle lifecycle behavior. |
src/hyperlight_component_csharp/src/Runtime.cs |
Implements dictionary-backed resource storage and entry removal. |
CHANGELOG.md |
Documents the C# resource-table retention fix. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ResourceTable<T>in the C# component runtime keeps an entry for everyGiveandLend, so a long-lived sandbox that passes resources grows without bound.This stores entries in a dictionary keyed by an increasing counter and removes them on
Take, at the end of a loan and when a gift is undone. Handles are never reused.Fixes #2056