This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have a problem com my aplication. My application has 100 thread that use many cache. The problem is that after that aplication consume 4GB, the machine alloc memory until have no more memory in the machine. The aplicarion no exit e no get OutOfMemory, but run using 7,9 GB de memory. The problem is that the command top show that aplication consumed 4G, but has 7,9 GB de memory alloc. No has any more process in the machine. The memory swap no is used in no moment and the gclog.txt show gc corrects. I think that has any bug with the GC.
What is the error ??
Information: - The machine has 8GB RAM and 16GM de swap.
- The machine is Linux and the version de jdk is: java version "1.4.2_10" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03) Java HotSpot(TM) 64-Bit Server VM (build 1.4.2_10-b03, mixed mode)
First, I would not tweak memory parameters unless you know precisely what you are doing and have hard proof of before and after improvements. The exception is the ceiling:
I believe that is the maximum the 1.4 JVM can handle and even if it's not your GC will be seriously bogged down with a 4G heap. Keep it at 2Gs, then fire up another JVM in parallel if you need more memory/processing power.
The other common reason for OOME is permanent memory exhaustion. That is where class information lives so if you have a lot of classes loaded you can exhaust that. You should VERIFY that using the memory monitor available with 1.4. You should watch the permanent memory block under load. Make sure you have 16 megs or so of headroom. The default permsize is 64m for serer mode.
BTW, are you CERTAIN your cache is flushing old content and recycling memory? [ February 24, 2006: Message edited by: Rick O'Shay ]
To study the memory usage in GC, as well as how your application works, this includes Servlet and Server-Side JSP scripting. You may consider to enable the JConsole JMX port in your application server, and start-up JConsole to monitor the detailed behaviours of your applications.
JConsole is one of the great memory diagnostic tool which bundled together with JDK :)