Thursday, November 15, 2007


Taking Things for Granted

As a long time Java developer who has been recently working in C/C++ I have realized that there are a few things in Java that I really have taken for granted. The biggest thing by far has to be the automatic memory management. Most of the time we Java programmers don't even think about until there is a problem. And with modern JVM's the problems don't happen as often as they did back with the earlier JVM's so problems aren't as common. I always am interested to see how things work under the hood and lately the garbage collector is one thing I am having fun with. For one thing there are plenty of ways to configure it. To really use any of those configurations you really have to understand what is going and a good article to get started with is here at the IBM Developer Works.

So why is it really important to understand Java's garbage collection? Garbage collection can be the cause of one of those things that makes people say that Java is slow. One of the worst bugs I had to deal with was a serious performance problem on a large scale J2EE application and involved the garbage collector. The real bug was that someone was instantiating an incredible amount of short lived objects when they shouldn't have and this caused the garbage collector to use more and more of the CPU eventually causing disastrous slow downs of the application. This happened about 6 years ago and unfortunately some try people to lay blame to Java for things like this. But I know better, try and see what happens when you have to manage you own memory and abuse it (hint, much worse things happen than just a slow down!).

Comments: Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?