0

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.

biz14
  • 187
  • 1
  • 2
  • 9

1 Answers1

2

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:


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.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • how small should I bring it to say 64Mb? I notice when it is 64Mb I find lots of FGC that is where I increase it to now 256Mb. – biz14 Mar 28 '13 at 10:03
  • It depends on how much memory your application needs. Think about it ... what you are trying to do is to make it so that the application has enough memory to run if it doesn't leak memory. It probably will do lots of FGCs. You are trying to figure out if those FGCs get more and more frequent, and then turn into an OOME. – Stephen C Mar 28 '13 at 10:44
  • 1
    The other alternative is to *assume* that you have a leak, and go looking for what causes it. – Stephen C Mar 28 '13 at 10:47
  • @I am also not too sure exactly how much memory will my application need as I got quite a lot of database operation like select,insert etc which I make sure close all the resultset and statement after each use. Could it also be that I am using lots string variable which I read some where it say that could be a possible problem too. – biz14 Mar 28 '13 at 14:25