expression-language icon indicating copy to clipboard operation
expression-language copied to clipboard

BeanELResolver cache causes Class Loader leaks in app servers

Open lprimak opened this issue 1 year ago • 4 comments

Currently, BeanELResolver caches Class elements in its SoftReference maps. This causes it's ClassLoader to be referenced in the cache. BeanELResolver internal SoftReference map only gets cleaned up via cleanup() method, which doesn't necessarily get called often enough to prevent Out-Of-Memory errors. The other issue is that, even when cleanup() is called enough to prevent OOMs, the 'danglng' ClassLoaders cause VM to run at it's max memory capacity, causing unnecessary GC and memory allocation thrashing.

clearProperties() method is needed to clear the cache from the ClassLoaders and thus prevent the leak

lprimak avatar May 02 '24 05:05 lprimak