diff --git a/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java b/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java index 1a7e33c65..6d26f1bfa 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java @@ -1,5 +1,7 @@ package com.velocitypowered.proxy; +import io.netty.util.ResourceLeakDetector; +import io.netty.util.ResourceLeakDetector.Level; import java.text.DecimalFormat; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -29,6 +31,12 @@ public class Velocity { if (System.getProperty("velocity.natives-tmpdir") != null) { System.setProperty("io.netty.native.workdir", System.getProperty("velocity.natives-tmpdir")); } + + // Disable the resource leak detector by default as it reduces performance. Allow the user to + // override this if desired. + if (System.getProperty("io.netty.leakDetection.level") != null) { + ResourceLeakDetector.setLevel(Level.DISABLED); + } } /**