3 ms·
A good GCed language should give you good controls about garbage generation. If you have not these controls, the language is to blame, not the concept of GC. Bu
by _ph_ 11y ago
A good GCed language should give you good controls about garbage generation. If you have not these controls, the language is to blame, not the concept of GC. But indeed, I think one of the strongest disadvantages of Java is that it does not give you much control about garbage generation.
- whateveracct 11y agoWhat languages give you more control over GC than Java? My only experience is Java and Go. Go gives you literally one knob, whereas Java allows you to tune MANY factors on top of picking a collector.
- pjmlp 11y agoModula-3, just as one possible example. Sadly the whole set of DEC, Compaq, HP acquisition processes killed it.
- _ph_ 11y agoI was talking about garbage generation. For best performance, you want to control heap allocation and the memory layout. Java gives you no controls there. All objects in Java are heap allocated, you can reference them only by pointer. In Go you can have value-types. An array in Go can be a block of structures, while in Java it would have pointers to separately allocated object. Also, if you have objects as member variables in a Java object, they cannot be part of that object, but need to be separate objects on the heap. This limits quite a few optimizations.