expression-language
expression-language copied to clipboard
BeanELResolver cache causes Class Loader leaks in app servers
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