Java Heap Space

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
Sachin_AjmaniAsked:
Who is Participating?
 
sompol_kiatkamolchaiCommented:
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
 
Khalid Mehmood AwanCommented:
Try to increase heap size in your webserver configuration files... I dont know exactly about glassfish's configurations.
0
 
sompol_kiatkamolchaiCommented:
What is your application? Why it comsumes memory too high?
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
aman123_123Commented:
Try profiling the application. Looks like you are creating heavy objects inside loop.
0
 
Sachin_AjmaniAuthor Commented:
hi sompol_kiatkamolchai:
it is a GPS server so you can think that clients load is always there.
0
 
Khalid Mehmood AwanCommented:
i guess the java application is trying to open/load a big input file in it...
0
 
Sachin_AjmaniAuthor Commented:
i dont know right now what happening there Please tell me how to flush it...
0
 
arevuriCommented:
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
 
Ajay-SinghCommented:
>>  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
 
Sachin_AjmaniAuthor Commented:
good
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.