2 ms·
It is poor man's GC, but the memory semantics are exactly the same as the previous version. Since `use_hook` owns a value for the lifetime of the component, tha
by jkelleyrtp 3y ago
It is poor man's GC, but the memory semantics are exactly the same as the previous version. Since `use_hook` owns a value for the lifetime of the component, that value is dropped when the component drops. All signals still `use_hook` so their lifetimes are the same. No performance impact whatsoever since we generally discourage calling `GenerationalBox::new()` outside of use_hook.
Now if you spammed `GenerationalBox::new()` in a loop or something, yeah, your garbage will exist until the component drops. But most of the time folks will just push/pop from a Map or a Vec and regular memory semantics apply.