4 ms·
1. Can you give an example of some of these systems? 2. Designing your code in such a way that requires it to invoke the GC seems counter-productive. If your a
by rian 13y ago
1. Can you give an example of some of these systems?
2. Designing your code in such a way that requires it to invoke the GC seems counter-productive. If your algorithm is producing a bunch garbage that is statically known, why not just release that memory explicitly? Invoking the GC is way more expensive than necessary here.
3. New/delete will always be used in performance critical code but I think the point is that in general it's not a good practice.
- dmitrygr 13y ago1. http://www.azulsystems.com/presentations/qcon-london-2011 http://www.azulsystems.com/presentations/qcon-london-2011 2. fair but irrelevant. the argument was that there is no way to make GC happen. It was wrong. I never objected to the (perhaps more interesting) argument that one should be able to manually delete objects 3. then the parent should have said "in toy codebases, whose function is to look pretty, new and delete have no place" instead of a sweeping generalization that all uses of new and delete are archaic and wrong. That one generalization was an insult to every llvm & WebKit developer out there. Disclaimer: i have no dog in this race - i prefer to work in C and think anyone who cannot free their own memory should maintain a safe 5 meter distance from any compiler. (this is my opinion only, of course)
- agwa 13y ago> 3. New/delete will always be used in performance critical code but I think the point is that in general it's not a good practice. There's zero runtime overhead to using std::unique_ptr - the compiler will inline the calls to delete you'd otherwise be writing by hand.