Skip to content

Add ASM metadata reader fallback and slim ClassFile method metadata#36978

Open
LordKay-sudo wants to merge 1 commit into
spring-projects:mainfrom
LordKay-sudo:gh-36737-asm-metadata-reader-fallback
Open

Add ASM metadata reader fallback and slim ClassFile method metadata#36978
LordKay-sudo wants to merge 1 commit into
spring-projects:mainfrom
LordKay-sudo:gh-36737-asm-metadata-reader-fallback

Conversation

@LordKay-sudo

Copy link
Copy Markdown

Summary

Addresses bclozel's issue 2 and the ASM workaround discussed in gh-36737:

  • Adds -Dspring.classformat.metadatareader.asm=true to select the ASM-based SimpleMetadataReaderFactory on Java 24+ (official alternative to shadowing MetadataReaderFactoryDelegate)
  • Reduces retained memory per method in ClassFileMethodMetadata by storing int access flags and JVM descriptor strings instead of AccessFlags / MethodTypeDesc objects

Context

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants