Memory Leak due to not pruning factoryBeanObjectCache when closing the ApplicationContext [SPR-15722] #20278
For our, on Spring Boot based, project we have quite some integration tests. Some of these integration tests create a new application context due to custom configuration or the use of
To limit the number of cached contexts (as they are fairly large) we decided to reduce the number of cached context by setting the
However we noticed that after running some tests we were leaking memory. After fixing some issues with our own code (static references to the app context). We still noticed a leak.
After some digging we noticed that, amongst others, the
Some further digging lead to the discovery that a
Our workaround is now to call
Juergen Hoeller commented
Good point. We're clearing the
I'll backport this to 4.3.10 right away. Please give it a try and let me know whether it works for you.