Class GcLogging
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Asks the JVM for a GC log, which is how the app learns how much heap a server really keeps alive.
public static class GcLogging
- Inheritance
-
GcLogging
- Inherited Members
Remarks
The numbers a process shows from outside say how much memory it holds, not how much it needs: the heap is full of garbage between collections. Only the collector knows what survived, and it says so in the log, after every collection.
The path is relative to the server's folder, where the process runs: -Xlog uses colons to
separate its own parts, so a drive letter would break it. A small rotating pair of files keeps it
at 16 MB at most. It sits in a hidden folder the world backup never reads.
A log that cannot be opened stops the JVM from starting, so the flag is given only after the
folder has been made and could be written to, and never on a Java that does not know it
(-Xlog came with Java 9; OpenJ9 has its own, different option).
Fields
FileName
The file name the JVM writes, with the rotated copies next to it.
public const string FileName = "gc.log"
Field Value
FolderName
The hidden folder inside a server's folder that holds the log.
public const string FolderName = ".mcserverlauncher-memory"
Field Value
MinimumJava
The first Java release the app asks for a log: the long-term one after -Xlog appeared.
public const int MinimumJava = 11
Field Value
Methods
Flag(JavaRuntime, string?)
The flag that makes the JVM write the log, or null when it should not be asked: an older Java, OpenJ9, or arguments that already configure logging and would be overridden.
public static string? Flag(JavaService.JavaRuntime java, string? extraArgs)
Parameters
javaJavaService.JavaRuntimeextraArgsstring
Returns
FlagsFor(ServerConfig, JavaRuntime)
The flags to add to this start's command line: the log, or nothing.
public static IReadOnlyList<string> FlagsFor(ServerConfig config, JavaService.JavaRuntime java)
Parameters
configServerConfigjavaJavaService.JavaRuntime
Returns
LogPath(string)
The log's path for a server.
public static string LogPath(string serverFolder)
Parameters
serverFolderstring
Returns
Prepare(string)
Makes the folder and clears the last run's files, so the reader never mistakes them for this run's. Returns false when it cannot, which means the flag must not be given.
public static bool Prepare(string serverFolder)
Parameters
serverFolderstring