The Source for Java Technology Collaboration
User: Password:



Start New Message Post a Reply

Subject:  GC is overrated
Date:  2008-04-30 03:30:02
From:  mayhem
Response to: GC is overrated


I think you need to separate the "problems" with memory allocation. What you are talking about is performance problems, which may or may not exist in a GC'ed language depending on the implementation. To tackle a GC related performance problem, you can often avoid memory allocation inside performance critical code. The advantage C++ has over Java is that you can use stack allocation, which is basically free, inside performance critical code. Note that an advanced VM with full escape analysis can do this automatically for you, it's just that the JVM doesn't do this at the moment. So, the performance problems are not really related to GCs as a concept, rather to specific implementations of them.

The other problem you mention is memory leaks. Here I would say having a GC is far superior to explicit memory deallocation. You can still have memory leaks in Java but they are basically caused by the same code pattern (listeners) and when you know about the problem you can quite easily avoid it (using weak references).

 Feed java.net RSS Feeds