Skip to content

Conversation

@xjaja
Copy link
Contributor

@xjaja xjaja commented Feb 24, 2023

Have a circular reference between the weak map of key and value.

It splits the circular reference of key and value.

Now, the Fiber with Suspension object, so if the object is not keep, garbage collected will occur at the next Fiber suspend .

related #52 (comment).

@kelunik
Copy link
Member

kelunik commented Feb 24, 2023

@trowski Thoughts?

@kelunik kelunik requested a review from trowski February 24, 2023 18:50
@trowski
Copy link
Member

trowski commented Feb 24, 2023

Wrapping the suspension into a WeakReference effectively removes reuse of Suspension objects. Should we instead drop this cache entirely?

If it useful for debugging (personally I haven't really found it to be), we could keep an array of WeakReferences like this but only if assertions are enabled.

@trowski
Copy link
Member

trowski commented Apr 20, 2023

Closing in favor of #78.

@trowski trowski closed this Apr 20, 2023
@kelunik
Copy link
Member

kelunik commented Apr 20, 2023

@trowski I favor this one over the other, because it has less BC impact.

@trowski
Copy link
Member

trowski commented Apr 20, 2023

What sort of BC impact are you seeing? Driver::getSuspension() will always return a new instance in this PR unless the user happened to retain a reference to the prior suspension (which they really shouldn't if not suspended). The modified APIs are all internal, so the only change to the public API is that a new Suspension instance is always returned.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants