You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DefaultRPBuilder.getSourceData never closes its source InputStream (native memory leak) #294
DefaultRPBuilder.getSourceData(String) does getSourceStream(path).readAllBytes() without closing the stream, getSourceStream opens it with Files.newInputStream on a jar’s zip filesystem. The zip filesystem keeps every open entry stream, and its native zlib Inflater is reachable until it is closed so none of them get garbage collected
Every ResourcePackBuilder.getDataOrSource() call that falls back to a source jar leaks about 40 KB of native memory for the life of the server. Any mod that reads a lot of source assets during generation starts building up quickly;; there was a measured 188,497 live java.util.zip.Inflater / ZipFileSystem$EntryInputStream objects after a full GC, about 7.4 GB of native memory that NMT doesn’t track (process commit 9.7 GB, NMT total 2.4 GB) and this eventually crashed the JVM with “Native memory allocation (malloc) failed” error
With the stream closed, live Inflaters after generation dropped from 188,497 to 226 and process commit from 9.7 GB to 1.4 GB
Activity