After upgrade from Spring Boot 2.2.6 to 2.2.7 application started consuming much more memory.
In particular Heap Dump shows significantly higher number of instances of type:
org.springframework.boot.loader.jar.JarFile
.
Heap Dump (v2.2.6) is here.
It contains the following number of instances:
Heap Dump (v2.2.7) is here.
It contains the following number of instances:
The number of instances is significantly higher.
After checking the history of related changes there is a couple of commits that worth to be checked:
Create new JarFile instance for URL connections
Attempt to prevent JarFiles from being left open
Attempt to prevent JarFiles from being left open
Checkout current repository and perform the following steps:
$ ./mvnw clean package
$ cd target
$ java -jar spring-boot-2.2.7.RELEASE-memory-leak.jar
Now memory profiler can be attached.
After, adjust the version of the parent (spring-boot-starter-parent
) in POM to 2.2.6.RELEASE
and perform the following steps:
$ ./mvnw clean package
$ cd target
$ java -jar spring-boot-2.2.6.RELEASE-memory-leak.jar
Now memory profiler can be attached again.