Upgrading Spring framework to v5.3.x increased memory usage for DefaultListableBeanFactory
search cancel

Upgrading Spring framework to v5.3.x increased memory usage for DefaultListableBeanFactory

book

Article ID: 410636

calendar_today

Updated On:

Products

VMware Tanzu Spring Essentials

Issue/Introduction

On this particular example a Spring app was upgraded from version 5.2.3.RELEASE to Spring version 5.3.31.RELEASE

We took a heapdump from a version of the App running v5.2.3 and also heapdump from a version of the App Running v5.3.31.

From the heap dump we noticed that org.springframework.beans.factory.support.DefaultListableBeanFactory has a retained heap size of 50MB in 5.2 and only 27MB in version 5.2

Environment

Spring Framework version 5.3.31

Resolution

The larger memory footprint in Spring Framework 5.3 is to be expected, since additional caching was introduced in various core components such as ResolvableType and DefaultListableBeanFactory.

However, based on the simulations that the memory footprint is stable and does not increase exponentially.

The memory footprint does not appear to grow out of bounds with thousands of requests hitting the system over time.