This probably shouldn't be an issue but I'm just creating this for means of documentation.
The way IO Events are handled (more specifically the Mouse Prioritization System) uses a wacky EventFrame system that requires you to call free() when you don't need the object anymore.
Of course, this is very error-prone as memory leaks can easily be created by simply forgetting to call free() which should be the garbage collector's job anyway!
So, the idea is to create an alternative to EventTargets / node:events that uses WeakMaps (or WeakRefMaps for iteratability) that wouldn't keep strong references that would make it automatically garbage-collectable.
(this might be best made into its own standalone package, weak-events anyon- oh wait that's already taken)
This probably shouldn't be an issue but I'm just creating this for means of documentation.
The way IO Events are handled (more specifically the Mouse Prioritization System) uses a wacky EventFrame system that requires you to call
free()
when you don't need the object anymore.Of course, this is very error-prone as memory leaks can easily be created by simply forgetting to call
free()
which should be the garbage collector's job anyway!So, the idea is to create an alternative to
EventTarget
s /node:event
s that usesWeakMap
s (orWeakRef
Map
s for iteratability) that wouldn't keep strong references that would make it automatically garbage-collectable.(this might be best made into its own standalone package,
weak-events
anyon- oh wait that's already taken)