Hi,
in recent profiling sessions of Spring-Boot apps, I noticed that instances of ResolvableType are retained by their DefaultVariableResolver
:
Until now I've not seen any critical leaks but I thought better be safe than sorry.
Let me know what you think. Cheers, Christoph
Comment From: jhoeller
Isn't this just moving the ResolvableType
instance reference in the inner class from implicit to explicit? What difference does this make in terms of garbage collection?
Comment From: dreis2211
The explicitness comes from the change to a static class. But you're right. I missed that asVariableResolver()
is not public. As the VariableResolver
can't really be exposed to the outside there is probably no immediate risk of a memory leak (unless someone does some weird reflection).
Having that said, I still think it is a worthwhile change. There is the consistency argument as TypeVariablesVariableResolver
is static as well. Additionally, some IDEs (or tools) warn about non-static inner classes as they can cause memory leaks. In fact, the tool I used warned me about retained objects by their inner class - I've just missed to dig deeper (sorry for that).
Of course, feel free to decline the PR.
Comment From: jhoeller
Good point about consistency there, and it's an easy enough change to make indeed.