If mark/sweep is/was trumping reference count (which it should anyway), then (small) 'floating rings/clusters' have/would have 'gone after a while/with many marks and sweeps' anyway... but obviously, leaving other objects with incorrect reference count.
In your breaking example, did a got freed? ...and oops - even though global (I assume) - ended up with wrong reference count?
if a not global(ly reachable), it would go on a mark/sweep (when mark/sweep has precedence over reference count).
Early 90' when writing a oo vm in PL/1 on main pc for use on mainframe, I started out with reference counting... and it got pretty far... but only mark/sweep pulled true... so I abandoned reference count altogether (and would have lost the quick 99% freeing when memory would have been used with linked lists... ;-) ). Reference count was not even usable for validation/confirmation of freeing with single mark/sweep and multiples (I thought) I could not afford (next to the additional storage to remember that the last mark/sweep.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Interesting, nice little caveat...
If mark/sweep is/was trumping reference count (which it should anyway), then (small) 'floating rings/clusters' have/would have 'gone after a while/with many marks and sweeps' anyway... but obviously, leaving other objects with incorrect reference count.
In your breaking example, did
a
got freed? ...andoops
- even though global (I assume) - ended up with wrong reference count?if
a
not global(ly reachable), it would go on a mark/sweep (when mark/sweep has precedence over reference count).Early 90' when writing a oo vm in PL/1 on main pc for use on mainframe, I started out with reference counting... and it got pretty far... but only mark/sweep pulled true... so I abandoned reference count altogether (and would have lost the quick 99% freeing when memory would have been used with linked lists... ;-) ). Reference count was not even usable for validation/confirmation of freeing with single mark/sweep and multiples (I thought) I could not afford (next to the additional storage to remember that the last mark/sweep.