Re:Proposed New Go GC: Transaction-Oriented Collector
by strictfp on Friday June 24, 2016 @04:33PM
(#11973231)
I've been thinking about this before as RAII with optional deferring of recollection when batching would be advantageous , for instance when you have a high allocation pressure and small blocks.
[ Parent
| on HN ]
Re:Proposed New Go GC: Transaction-Oriented Collector
by Doradus on Friday June 24, 2016 @08:13PM
(#11974487)
RAII is using one C++ misfeature (destructors) to work around another misfeature (inability to do cleanup when leaving a lexical scope). Go has a far more elegant solution to the latter; if you're not familiar with the defer statement, check it out.
Re:Proposed New Go GC: Transaction-Oriented Collector
by strictfp on Saturday June 25, 2016 @03:08AM
(#11975537)
Eh, defer is more similar to javas try-with-resources or C#:s using, who both put the burden on the user of the object and cannot handle recursive cleanup (cleanup of trees). So I consider it much worse than destructors.
Re:Proposed New Go GC: Transaction-Oriented Collector
by stormbrew on Saturday June 25, 2016 @12:08AM
(#11975171)
Except that deterministic destruction is actually a feature that enables cleanup when leaving a scope. Manually peppering your code with defer statements is often doing work a computer can do better than you can.