?
Solved

Java Heap Space

Posted on 2009-12-24
10
Medium Priority
?
784 Views
Last Modified: 2013-12-22
hi experts

I m facing problem regarding Java Heap Space...

I m running Glassfish at my 64bit Operating System in Linux open suse. I m using 8GB Ram and i also know that i have to increase java heap space and i have increase jave heap space upto 6 GB but when i start my glassfish server and glassfish start listen client requests then RAM uses also increasing upto 6GB and after that i get error out of memory due to Java Heap Space...

Please tell me How to flush or set java heap space that when it uses all allocate memory which i allocated then it will flush or empty or free all previous used heap space...

Thank in advance
0
Comment
Question by:Sachin_Ajmani
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 5

Expert Comment

by:Khalid Mehmood Awan
ID: 26118426
Try to increase heap size in your webserver configuration files... I dont know exactly about glassfish's configurations.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 26118431
What is your application? Why it comsumes memory too high?
0
 
LVL 4

Assisted Solution

by:aman123_123
aman123_123 earned 300 total points
ID: 26118438
Try profiling the application. Looks like you are creating heavy objects inside loop.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Sachin_Ajmani
ID: 26118440
hi sompol_kiatkamolchai:
it is a GPS server so you can think that clients load is always there.
0
 
LVL 5

Expert Comment

by:Khalid Mehmood Awan
ID: 26118480
i guess the java application is trying to open/load a big input file in it...
0
 

Author Comment

by:Sachin_Ajmani
ID: 26118512
i dont know right now what happening there Please tell me how to flush it...
0
 
LVL 6

Assisted Solution

by:arevuri
arevuri earned 300 total points
ID: 26118530
You should look into optimizing your GPS application and also scaling horizantally. By increasing number of servers/application instances.
It is not at all recommended to use such a huge heap space usually.
0
 
LVL 11

Accepted Solution

by:
sompol_kiatkamolchai earned 900 total points
ID: 26118558
I think by default garbage collector should work for you for unused java object.

In your case, there might be some coding that forget to remove unused java object from memory.

The most common case that developer often forget is to add java object to collection class such as ArrayList, Vector, Hashtable and hold it as static reference and no remove operation on it.

Try to check with your developer.

Hope this help,
Sompol
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 26123673
>>  Please tell me How to flush or set java heap space that when it uses all allocate memory which i allocated
Can be done by setting -Xmx and -Xms to same value.

 >> then it will flush or empty or free all previous used heap space...
Which previous heap? There is no way to flush memory of a running jvm.
0
 

Author Closing Comment

by:Sachin_Ajmani
ID: 31669739
good
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question