Meaningless Drivel is fun!
The moose likes Java in General and the fly likes GC alloc all memory of machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "GC alloc all memory of machine" Watch "GC alloc all memory of machine" New topic

GC alloc all memory of machine

Haroldo Nascimento
Ranch Hand

Joined: Aug 14, 2003
Posts: 79

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 ??


- The machine has 8GB RAM and 16GM de swap.

- Start my aplication stand-alone with:

java -verbose:gc -jar -Xms4048M -Xmx4048M -XX:NewSize=512M -XX:MaxNewSize=512M -XX:+PrintGCDetails -Xloggc:gclog.txt extractor.jar >> saida.txt &

- 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)
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
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 ]
Kl Allen

Joined: Nov 23, 2009
Posts: 1
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 :)

Warm Ice
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10826

Warm Ice wrote:

Welcome to the Ranch.
Please check your private messages for an important administrative matter.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

Warm Ice, please note that the topic you are responding to is three and a half years old. I don't think the original poster is still waiting for an answer - please don't wake the zombies.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: GC alloc all memory of machine
jQuery in Action, 3rd edition