Skip to content

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Aug 13, 2025

The Util.findSam() method uses ClassValue to cache its result, which for some reason I do not claim to understand seems to cause a classloader leak. It feels likely the cause is more subtle, or entirely different, but avoiding ClassValue caching seems to get rid of the leak, or at least of its symptoms, so after spending two days staring into heap dumps and figuring out nothing, I'm just removing it and leaving it for someone else :-)

The `Util.findSam()` method uses `ClassValue` to cache its result, which
for some reason I do not claim to understand seems to cause a classloader
leak. It feels likely the cause is more subtle, or entirely different,
but avoiding `ClassValue` caching seems to get rid of the leak, or at least
of its symptoms, so after spending two days staring into heap dumps and
figuring out nothing, I'm just removing it and leaving it for someone else :-)
@Ladicek Ladicek added this to the 2.0.0.Beta6 milestone Aug 13, 2025
@Ladicek Ladicek added the 2.x Issue applies to Gizmo 2.x label Aug 13, 2025
@Ladicek Ladicek moved this to In Progress in WG - Gizmo 2 Aug 13, 2025
@Ladicek Ladicek merged commit f2ce719 into quarkusio:main Aug 13, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in WG - Gizmo 2 Aug 13, 2025
@Ladicek Ladicek deleted the avoid-classloader-leak branch August 13, 2025 15:42
@dmlloyd
Copy link
Member

dmlloyd commented Aug 25, 2025

It's because MethodDesc is in our class loader, and the JDK is keeping a strong reference to all the values of ClassValue. The change looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issue applies to Gizmo 2.x
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants