Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating from Java VM 5 to 6 gave a really big increase of memory consumption

I've be working with a Java application run through the command-line. It deals with XML files, specially the dblp.xml database which has more than 400MB.

I was using JVM 5 and my app needed sort of 600-700MB of memory to processe the dblp.xml. After updating to JVM 6, it starting needing more than 1gb of memory (something I don't have), although it runs a bit faster.

I'm pretty sure of the memory consumption difference, because I've already tested both again and again in this same computer. Resulting in the same difference of memory consumption.

I didn't set any special parameters, just -Xmx800M or -Xmx1000M. Running with Ubuntu Hardy Heron on a dual core 1.7ghz, with 1,5gb of memory Using only the top/ps commands to measure

Any one have an idea why this occurs? I really wanted to use JVM 6, because in my production server it is the JVM in use, and I'm not quite able to change easily.

Thanks

like image 626
Felipe Hummel Avatar asked Mar 02 '23 04:03

Felipe Hummel


1 Answers

My advice would be to use a tool like JProfiler to try to get a handle on exactly where your memory consumption increased. If you can't spend on JProfiler, check out this list of open source java profiling tools.

Guessing at the cause of performance problems is a bad idea, because you are almost always wrong in your guess, and you waste time optimizing the wrong piece of the system. Once you have some objective data, you may be able to come up with an optimization reducing your memory consumption.

If it is true that the newer JVM is trading memory for speed (by caching) then there is likely a jvm arg you can use to stop this behavior. Best bet is to check out the release notes for Java 6 and see if any such feature is mentioned.

like image 141
Justin Standard Avatar answered Mar 06 '23 14:03

Justin Standard