From 7388f2b60b14c49c7f6660ef8de1f7af3dcc537d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 14 Oct 2021 20:22:07 -0700 Subject: [PATCH] Attempt to reduce JarFileWrapper heap consumption Update `JarURLConnection` to use a single shared wrapper per jar file rather than creating a new one each time. This update should help to reduce GC pressure. Fixes gh-28042 --- .../org/springframework/boot/loader/jar/JarFile.java | 11 +++++++++++ .../boot/loader/jar/JarURLConnection.java | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index e17e72b00a..81386386f9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -91,6 +91,8 @@ public class JarFile extends AbstractJarFile implements Iterable