Custom nodes hold their inputs strongly while up-to-date - #123
Open
krauthaufen wants to merge 2 commits into
Open
krauthaufen wants to merge 2 commits into
krauthaufen wants to merge 2 commits into
Conversation
Edges are weak, so a node created and read inside a custom compute function was collectable, silently dropping the dependency. IInputHoldingObject lets EvaluateAlways hand each read input to the caller; AVal/ASet/AMap/AList.custom keep them until marked.
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.
Fixes #122.
Dependency edges are weak (
Outputsonly), so a node that is created and read inside acustomcompute function is unreachable once evaluation returns. After the next GC the chainsource -> inner -> outeris gone andouteris never marked again — silently.Fix, the idiomatic one: a custom node holds the inputs it read strongly for as long as it is up-to-date, exactly like
bindholds its inner node. New public interfaceIInputHoldingObjectwithAddInput;EvaluateAlwayshands each read input to the caller if it implements it (one type test next to the existingOutputs.Add; nothing for other objects, noIAdaptiveObjectchange).AVal.customand theASet/AMap/AList.customreaders implement it: clear onMark, refill duringCompute. No locking needed —AddInputruns under the caller's monitor by construction,Markunder the transaction'sEnterWrite.Test: all seven shapes from the issue plus reads inside the collection customs, forcing a full GC between reads; fails without the
EvaluateAlwayscall site, passes with it. Full suite green.