Eden Space reclaim

Hi,

I tried to analyze how my tomcat was behaving by printing out the different memory behaviours as follows:

localhost

MEMORY TYPE: Code Cache

Used: 4 mb

Committed: 4 mb

Max: 48 mb

MEMORY TYPE: PS Eden Space

Used: 25 mb

Committed: 33 mb

Max: 54 mb

MEMORY TYPE: PS Survivor Space

Used: 0 mb

Committed: 1 mb

Max: 1 mb

MEMORY TYPE: PS Old Gen

Used: 10 mb

Committed: 227 mb

Max: 455 mb

MEMORY TYPE: PS Perm Gen

Used: 14 mb

Committed: 16 mb

Max: 128 mb

localhost

MEMORY TYPE: Code Cache

Used: 4 mb

Committed: 4 mb

Max: 48 mb

MEMORY TYPE: PS Eden Space

Used: 26 mb

Committed: 33 mb

Max: 54 mb

MEMORY TYPE: PS Survivor Space

Used: 0 mb

Committed: 1 mb

Max: 1 mb

MEMORY TYPE: PS Old Gen

Used: 10 mb

Committed: 227 mb

Max: 455 mb

MEMORY TYPE: PS Perm Gen

Used: 14 mb

Committed: 16 mb

Max: 128 mb

localhost

MEMORY TYPE: Code Cache

Used: 4 mb

Committed: 4 mb

Max: 48 mb

MEMORY TYPE: PS Eden Space

Used: 27 mb

Committed: 33 mb

Max: 54 mb

MEMORY TYPE: PS Survivor Space

Used: 0 mb

Committed: 1 mb

Max: 1 mb

MEMORY TYPE: PS Old Gen

Used: 10 mb

Committed: 227 mb

Max: 455 mb

MEMORY TYPE: PS Perm Gen

Used: 14 mb

Committed: 16 mb

Max: 128 mb

What I noticed is that the PS Eden Space keeps increasing each time a request comes and once it reaches the committed size I have to restart my tomcat server.

Is there a way I could reset it to zero once the used memory is 3/4th

or more of the committed heap memory?

I tried System.gc() but it did not work, would I be able to use jconsole for doing it?

Please let me know id I can and how I could.

Thanks,

Samanth.

[1978 byte] By [Samantha] at [2007-11-26 23:46:45]
# 1

You can use JConsole to trigger a GC on a running VM.The article describes how to do that as well as the low memory detection support:

http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

However, the low memory detection support doesn't apply to the Eden space. HotSpot VM uses generational garbage collection for memory management. The Eden space is the youngest generation in which most of the objects are allocated. It is designed to be filled up frequently and its memory will be freed when the short-lived objects are collected. Over time the live objects will be moved from the eden space to the old generation depending on the object age.

What problem occurred that cause you to restart tomcat? Was it OutOfMemoryError? If OutOfMemoryError, there are several possible reasons. I recommend you to check out:

Java SE Troubleshooting and Diagnostic Guide:

http://java.sun.com/javase/6/webnotes/trouble/

Article: Monitoring and Managing Java SE 6 Platform Applications:

http://java.sun.com/developer/technicalArticles/J2SE/monitoring/

You can learn more about the garbage collection subsystem in the HotSpot VM from the documentation at:

http://java.sun.com/javase/technologies/hotspot/gc/index.jsp

Hope this helps.

Mandy

mandy_kochunga at 2007-7-11 15:20:25 > top of Java-index,Core,Monitoring & Management...