-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow clearing all caches to avoid classloader leaks #4953
Comments
Sounds like good idea. PR would be welcome (as usual, but might be easy enough to implement). On naming, instead of |
One other quick note: usually one should drop |
Completed for 2.19(.0). |
Is your feature request related to a problem? Please describe.
I'm using both hypersistence-utils and jackson in my Quarkus project and I see that my application classloader is not garbage collected on live-reload.
This seems to be caused by the static ObjectMapper in ObjectMapperWrapper.
The ObjectMapper is not loaded by the application classloader, but it does contain references to classes of the my application (custom deserializers etc). Hence, it blocks the garbage collection of the application classloader.
I described a similar case for hibernate-envers here.
Describe the solution you'd like
As mentioned in another issue, a
clear()
method on ObjectMapper to evict all caches before the application shuts down would probably solve this.Usage example
Specifically when using hypersistence-utils, it would be
ObjectMapperWrapper.INSTANCE.getObjectMapper().clear();
. That code would be placed in a method annotated with@Shutdown
.Additional context
No response
Workaround
The text was updated successfully, but these errors were encountered: