Profile Image
vishnupriya

What is Memory tuning: -XX:MaxDirectMemorySize?

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

  • jvmargument

  • xx-maxdirectmemorysize

  • x-maxdirectmemorysize

  • Memory tuning

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:                                                    

 

To limit amount of memory that can be reserved for all direct byte buffers use:

 

-XX: MaxDirectMemorySize=size[unit], where size represents the amount of memory you want to limit to, with unit possible values [k|K|m|M|g|G]

 

Examples:

 

Limits memory size to 20 Megabytes:


-XX:MaxDirectMemorySize=
20M

 

Description:

 

Sets the maximum total size (in bytes) of the java.nio package, direct-buffer allocations. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, and g or G to indicate gigabytes. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct-buffer allocations automatically.

 

Default Value:

 

By default, it is set to 0. Since JDK11 amount of heap memory used for Direct Byte Buffers limited to the same value as the maximum heap size.

 

Errors:

 

None

 

Arguments related:

 

TODO link UseG1GC, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms

 

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-maxdirectmemorysize

  • x-maxdirectmemorysize

  • Memory tuning