The following is a summary after a Java. Lang. outofmemoryerror: direct buffer memory error occurred
Causes:
It is used for NiO, but the direct buffer is not enough
Solutions
1) Check whether NiO is used directly or indirectly, such as manually calling the buffer generation method or using NiO containers such as netty, jetty, Tomcat, etc
2) – XX: maxdirectmemorysize is increased. The default value of this parameter is 64M, which can be increased according to the demand
3) Check if there is – XX: + disableexplicit GC in the JVM parameter, and remove it if there is
Code tracking:
When the ByteBuffer is generated, the allocation method is called. You can see system. GC ():