Skip to content

Conversation

@DunetsNM
Copy link

There's a memory leak if source property sits on a long living object while target is on a short living object.
Simple fix is to wrap target properties in WeakReference

@DunetsNM
Copy link
Author

DunetsNM commented Jul 3, 2017

used ConditionalWeakTable to improve add/remove performance. List of weak references still needed to iterate alive targets

@DunetsNM
Copy link
Author

DunetsNM commented Jul 3, 2017

Performance test case:

  1. Initial wiring: Create source with 50,000 immediate targets
  2. Re-wiring: unplug an old target and add a new target, repeat 50,000 times

Results on my machine (Release)

  • with HashSet: 0.2 sec for initial wiring and 0.3-0.4 sec for re-wiring
  • with ConditionalWeakTable: 0.3-0.4 sec for initial wiring and 0.7-0.8 sec for re-wiring

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.

1 participant