Learning about HotSpot options; also Java = pain

While researching a customer problem yesterday I became wildly more educated about Java garbage collection than ever before. I finally know what all the talk of “generations” is about.

Also it confirms my contention that Java programmers enjoy pain. I worked with Perl for over a decade and never once had to deal with a garbage collection problem. Memory leaks, yes, but those are pretty simple in Perl – look for circular references and remove or weaken them. I’m sure things get more complicated if you’re multithreading Perl, but that’s just the thing; multithreading is still unusual in the Perl world, while it’s ubiquitous in Java. Sure, multithreading can really improve your performance, but is it really appropriate to ask every Java programmer to have to deal with the complexity it entails? I think for most projects it would be a hell of a lot cheaper to just add on a few more servers.

Anyway, to record some of the links with really interesting JVM info:

Who would believe there’d ever be such a long document about nothing but Java garbage collection? You can pick between three major collection algorithms, each with extra options of course (what goes for one generation doesn’t for another!). And as a Java programmer, you pretty much have to know this stuff, if for no other reason than because you’ll run into cryptic error messages during development. Ever run out of PermGen space while developing a webapp? What the hell does that even mean? It only makes sense once you know a fair amount about HotSpot garbage collection. Until then you just know to reload the container whenever it shows up.

I will say this for Java memory management however: it’s very cool that it handles collecting objects with circular references (which is good because they appear to be rampant). That really makes a programmer’s job easier. And it’s also cool that you have the option to collect garbage concurrently with program execution rather than having to pause everything while it’s running – although this leads to even more complexity! – and is likely the source of my customer’s problem.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: