starlight
starlight copied to clipboard
PersistentRooted update inner workings
As discussed here: https://github.com/Starlight-JS/starlight/pull/65#issuecomment-872387245
for persistent roots i use a HashMap based on a generated ID, at first i thought i'd just use the inner ptr of JsObejct as ID but then it would not work when multiple jobs add a persistent root for the same object.
Your persistent root can be reference counted and stored in hash map. On GC when constraint for the Runtime instance is executed you just remove all the roots that have 1 reference count left. I think you can even just use Vec there?