Hacker News new | ask | show | jobs
by jlebar 4008 days ago
As another example, Firefox uses "manual reflection" to e.g. build lists of all the smart pointers in some classes. It then uses these lists as part of its "cycle collector", which breaks cycles in the refcounted graph of objects.

Writing and maintaining these lists is error-prone, and at least used to be a major source of memory leaks. You can imagine writing a static analysis to figure this out, and the Moz folks may have since I last checked, but if the language could do it, that would be so much better...

1 comments

As a somewhat-related data point, Servo is already using the macro deriving infrastructure of Rust to generate these lists at compile time for its garbage collector.
I understand the urge to evangelise, but does Rust have to crop up in every C++ thread?
It was in response to a comment that was referring to Firefox. Servo is touted as the eventual replacement of Firefox's rendering engine. It's literally a response to a comment about Mozilla's current practices in this area explaining their proposed future practices.

Seems appropriate to me.

Apologies if I made it seem like evangelism; just wanted to clarify the state of tracing cycle collection in Firefox-related projects.