starlight icon indicating copy to clipboard operation
starlight copied to clipboard

PersistentRooted update inner workings

Open andrieshiemstra opened this issue 3 years ago • 0 comments

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?

andrieshiemstra avatar Jul 02 '21 10:07 andrieshiemstra