Profile Image
vishnupriya

What is Memory tuning: -XX:SoftRefLRUPolicyMSPerMB?

What is Memory tuning: -XX:SoftRefLRUPolicyMSPerMB? Have you used this JVM arguement before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-softreflrupolicymspermb

  • x-softreflrupolicymspermb

  • Memory tuning

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

You can set the amount of time object is kept active on the heap after last time it was referenced with:

 

-XX:SoftRefLRUPolicyMSPerMB=time, where time is the amount of time in millis of  your choice.

 

Examples:

 

The following example shows how to set the value to 2.5 seconds:

 

-XX:SoftRefLRUPolicyMSPerMB=2500

 

Description:

 

Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced. The default value is one second of lifetime per free megabyte in the heap. The -XX:SoftRefLRUPolicyMSPerMB option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM). This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references. In the latter case, the value of the -Xmx option has a significant effect on how quickly soft references are garbage collected.

 

Default Value:

 

Default value is platform-dependent.

 

Errors:

 

None

 

Arguments related:

 

TODO link UseG1GC, Xmx, Xms, UseSerialGC, USeParNewGC, UseParallelGC, UseZGC

 

Related Posts:

NOTE:

 

If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-softreflrupolicymspermb

  • x-softreflrupolicymspermb

  • Memory tuning