Memory usage is reaching 100%

Hi,

Our SIT server is going down with memory issue ( memory usage is going to 100% ) on every day as huge number of services running. I thought to write a java service with below lines, kindly comment is it okay to schedule this service every 6hrs.

collectGarbage:
System.runFinalization();
System.gc();

I see this code runs a garbage collection cleaning the unused java objects. I assume this should be handled internally by IS architecture.

Analyse why the IS is consuming more memory, you have to check at IS level. Fine tuning the IS or re-sizing the JVM memory.

The JVM will desperately try to collect any garbage it can before throwing an OOME. Therefore, calling System.gc is not really going to help you and it’s typically not recommended.

If you’re running out of memory, then either you have allocated too little memory to the JVM (i.e. you need to increase your heap size) or you have a memory leak. A good way of finding out what’s going on is to perform a heap dump (you can configure the JVM to do a heap dump when it encounters an OOME with -XX:+HeapDumpOnOutOfMemoryError) and then analyze that dump with MAT (http://eclipse.org/mat/)

Percio

1 Like

Thanks for all your inputs. Let me do analysis on this.