Add ASM metadata reader fallback and slim ClassFile method metadata#36978
Open
LordKay-sudo wants to merge 1 commit into
Open
Add ASM metadata reader fallback and slim ClassFile method metadata#36978LordKay-sudo wants to merge 1 commit into
LordKay-sudo wants to merge 1 commit into
Conversation
Allow -Dspring.classformat.metadatareader.asm=true to use the ASM-based SimpleMetadataReaderFactory on Java 24+ as a workaround for high memory use of ClassFileAnnotationMetadata (spring-projectsgh-36737). Reduce retained memory per method by storing ASM-style int access flags and descriptor strings instead of ClassFile API type objects. Related to spring-projectsgh-36737 Signed-off-by: LordKay-sudo <lkandiro@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses bclozel's issue 2 and the ASM workaround discussed in gh-36737:
-Dspring.classformat.metadatareader.asm=trueto select the ASM-basedSimpleMetadataReaderFactoryon Java 24+ (official alternative to shadowingMetadataReaderFactoryDelegate)ClassFileMethodMetadataby storing int access flags and JVM descriptor strings instead ofAccessFlags/MethodTypeDescobjectsContext
Several reporters (@bherczyk, @lbenedetto, @pkernevez) resolved OOM by switching back to ASM metadata reading. This provides a supported configuration flag for that workaround while ClassFile memory use is further optimized.
Test plan
./gradlew :spring-core:test --tests "org.springframework.core.type.classreading.*"./gradlew :spring-core:test --tests "org.springframework.core.type.classreading.MetadataReaderFactoryDelegateTests"Related to gh-36737