3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Changes to make Velocity more amenable to memory leak detection

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-06-19 13:19:08 -04:00
Ursprung d7abf4457c
Commit 2b15f2e919
2 geänderte Dateien mit 3 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -52,10 +52,9 @@ public class Velocity {
System.setProperty("io.netty.native.workdir", System.getProperty("velocity.natives-tmpdir")); 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 // Set the ADVANCED level of the leak detector. Time to go hunting.
// override this if desired.
if (System.getProperty("io.netty.leakDetection.level") == null) { if (System.getProperty("io.netty.leakDetection.level") == null) {
ResourceLeakDetector.setLevel(Level.DISABLED); ResourceLeakDetector.setLevel(Level.ADVANCED);
} }
} }

Datei anzeigen

@ -59,7 +59,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
} else { } else {
int minimumRead = bytesRead + readVarint; int minimumRead = bytesRead + readVarint;
if (in.isReadable(minimumRead)) { if (in.isReadable(minimumRead)) {
out.add(in.retainedSlice(varintEnd + 1, readVarint)); out.add(in.copy(varintEnd + 1, readVarint));
in.skipBytes(minimumRead); in.skipBytes(minimumRead);
} }
} }