When using Netty, a memory overflow is often encountered and is queried for this pit:
The Netty used by the NIO and the XX:+DISABLEEXPLICITGC configuration in the JVM is caused by the conflict, specifically by: NiO uses direct memory for the region, and memory recovery is a bit different from other memory recycling. A direct memory reference is placed inside the Java heap, which, under normal circumstances, recycles the dead reference at the young GC and reclaims the native memory area, but some moves to the old Gen area without This object has not been recycled during GC, and direct memory should accumulate.
In addition, System.GC () is explicitly called when there is insufficient direct memory in the process of allocating space for directbytebuffer, in order to force an already useless Directbytebuffer object to release their associated native memory through the full GC. , this can be analyzed from the source code of Java.nio (Directbytebuffer. Class Bits.class)
XX:+DISABLEEXPLICITGC Considerations for Netty and JVM virtual machine parameters