- Joined
- Apr 21, 2005
- Sythe Gold
- 5,470
- Messages
- 8,076
If having a GC is your main reason for NOT using Java, keep in mind that .NET also implemented a garbage collector in the CLR, so if you're gonna hate on Java, you also gotta hate on C#. Memory is not a scarce resource anymore; I'm not saying using a GC will allow your program to perform better. If anything, it's quite the opposite (although, the results are seriously invisible to us, and VM could optimize enough to make a badly written program writting in Java run faster than a badly written program written in C++). But the pros outweight the cons.
If you're following this debate, just do your own research.
CLR gc is optional whereas Java's is not. Being forced to use a GC (in particular where you are also unable to manually deallocate memory) is a good reason not to use that particular programming language. As discussed GCs have significant overhead and lead to unpredictable non-deterministic runtime behaviour... program stalls etc. It's also still very possible to produce a memory leak in a GC'd language if you don't manage your references properly.
Maybe since you're invested so in the idea you'd like to write a guide to best practice programming with a GC? There are numerous tricks used in real programming languages like allocating shortlived objects onto the stack (so you don't have to fiddle with the heap which is expensive) which wouldn't be applicable in Java, but presumably there are some tricks you can use to make your application run without lagging out for 10 seconds every 3 minutes.
























