We have a socket listener programme running on centos machine. What is worrying is that the memory usage for the application via the top keep showing come minor increment. On the other hand the if we use the jstat gcutil it shows some minor increase in the Permanent Generation but so far they have been no FGC but many YGC. Could this be indicating any memory issue? Both max and initial memory have been set to 256M.
1 Answer
Could this be indicating any memory issue?
Maybe. What you are describing could be a memory leak caused by a bug in your application. If that is the problem, then eventually the application will fill up the Java heap .... and die with an OutOfMemoryError.
If you want to confirm this, try running the application with a much smaller heap; i.e. a smaller max heap size. If you have a leak, the application will crash after a shorter time.
There are lots of resources on finding Java memory leaks. Here are some:
- General strategy to resolve Java memory leak?
- How to find a Java Memory Leak
- http://netbeans.org/kb/articles/nb-profiler-uncoveringleaks_pt1.html
- http://rejeev.blogspot.com.au/2009/04/analyzing-memory-leak-in-java.html
There are other possible explanations for this ... including "there is no problem". But if you get OOME's then you do have a real problem.