cancel
Showing results for 
Search instead for 
Did you mean: 

Java VM Settings to avoid memory leaks

Former Member
0 Kudos

hello gurus,

we have currently a few memory problems with our netweaver AS Java. Once a week our server dies because of "return code 666: out of memory". We are using a netweaver AS Java 640 on an Windows 2003 x64 Server. It is a dedicated machine with 16 GB Ram. The memory settings in the JVM are:

-Xms4096M

-Xmx4096M

-Xss2M

-XX:+DisableExplicitGC

-XX:+PrintGCDetails

-XX:+PrintGCTimeStamps

-XX:+UseParNewGC

-XX:+UseTLAB

-XX:CodeCacheMinimumFreeSpace 2M

-XX:CompilerThreadStackSize 4096

-XX:MaxNewSize 682m

-XX:MaxPermSize 2048m

-XX:NewSize 682m

-XX:PermSize 2048m

-XX:ReservedCodeCacheSize 64M

-XX:SoftRefLRUPolicyMSPerMB 1

-XX:SurvivorRatio 2

-XX:TargetSurvivorRatio 90

We are running our b2b Shop on this server. I don´t know if the 4 GB are enough Memory for Java since we have 16 GB available within our machine. But I´d like to know if i can just increase the Heap Size to 8GB or more.

I´m looking forward to hear your recommendations.

best regards

Tobias

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hello Sunny,

did you read the note? I don´t think so.

This note recomments 2 GB Heap...

0 Kudos

Instead of increasing the heap size, it is advisable to create additional server node to get better availability and to reduce impact of GC time on response time. There is no JVM setting to avoid memory leaks, it can be fixed only by fixing the culprit Java code. You can find out the culprit class by heap dump analysis. The quick work around would be to update your JDK to the latest available as per SAP note 723909. Since the parameters you specified indicates that you are using SUN JDK, the latest version is 1.4.2_29.

Former Member
0 Kudos

Hello Vedprakash,

thank you for the advice. We are using the latest version of the JDK.

Maybe we try a second instance and speak to our developers regarding to heap dump analysis.

best regards

Tobias

hemanth2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear Tobias,

Unless you are using a BI server, 4GB ram on the server is too high. If the values of the heap are on the higher side, then this can lead to more garbage collection as well.

If the heap is not enough, please do increase it as per your need (max. 3G). Then add more server nodes / instances on the server. The rule of thumb for number of server nodes for SUN JavaVM with 2 GB Heap each will be

#ServerNodes = (AvailableMemory / 2.5 GB)

A cluster restart will be needed after addition of the server node. If you face the error again, kindly check the below link to generate the heap dump.

SAP Note No. 1004255- How to create a full HPROF heap dump of J2EE Engine

There is no side effect of this parameter; it will however write a heap dump, so make sure that here is enough free space

on the server. Even if the free space is less, it will not harm the server in any manner; just the dump written

will not be complete. This will hinder the analysis.

More details are available here:

http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/

f0a5d007-a35f-2a10-da9f-99245623edda&overridelayout=true

http://www.sdn.sap.com/irj/sdn/wiki?path=/display/java/

JavaMemoryAnalysis

http://www.ibm.com/developerworks/java/jdk/tools/mat.html

This should help you identify the memory leak.

Regards,

hemanth

Former Member
0 Kudos

It´s a dedicated machine with 16 GB Ram. Max Heap of the JVM Settings is 4 GB.

sunny_pahuja2
Active Contributor
0 Kudos

Ok. Change the parameter as described in SAP note 723909.

Thanks

Sunny

sunny_pahuja2
Active Contributor
0 Kudos

Hi,

As per your details, you have 4GB of RAM for this server and where as you have allocated 4GB to heap space which is not good. 4 GB of RAM is very less and you should increase the RAM.

As you have only 4GB of RAM available on the server, so you cannot allocate 8GB of RAM. Check SAP note 723909 for more information.

Thanks

Sunny