News for hackers. Stuff that matters.
Re:C++11 and Ada 2012 - renaissance of native languages? by deadc0de on Saturday June 23, 2012 @10:10PM (#4152396)
Not really. Allocation and deallocation for a system that does not support object movement (and hence compaction) is inherently non-trivial. In most modern GCs allocation is bump-the-pointer with TLABs, you can get cheaper than that. If the first generation GC is a copying GC you pay absolutely nothing for collecting a dead object. Compare that to explicit allocation/deallocation schemes.

The biggest problem with GC however is not the cost of allocation/deallocation but the fact that it's pretty hard to make GCs incremental at a very fine-grain level.

Java, btw, at least with Hotspot JVM, does escape analysis, that will allocate non-escaping objects on stack. Heck, these objects may even just end up in a register (with unused data members discarded).

Re:C++11 and Ada 2012 - renaissance of native languages? by pcwalton on Saturday June 23, 2012 @11:47PM (#4152533)
Nit: Collecting a dead object is not free with a copying GC. You still have to scan it during the Cheney scan or mark phase.