Skip to content

Reduce retained AST nodes during Java analysis#413

Open
somiljain2006 wants to merge 2 commits into
cbomkit:mainfrom
somiljain2006:Memory-optimization-fix
Open

Reduce retained AST nodes during Java analysis#413
somiljain2006 wants to merge 2 commits into
cbomkit:mainfrom
somiljain2006:Memory-optimization-fix

Conversation

@somiljain2006
Copy link
Copy Markdown

@somiljain2006 somiljain2006 commented May 14, 2026

Fixes #371

Reduce retained AST nodes during Java analysis to lower heap usage

Previously, the analyzer stored every Sonar AST node in a large List during analysis. On large repositories, this caused unnecessary object retention and increased JVM heap pressure, leading to excessive garbage collection activity and a higher risk of OutOfMemoryError.

This change reduces long-lived retention of AST nodes and processes them in a more memory-efficient manner.

Validation:

  • Successfully analyzed Apache SkyWalking (~2676 source files)
  • Completed Sonar analysis with -Xmx4g
  • No OOM or Full GC observed during analysis
  • Stable GC behavior and successful report upload

This improves scalability and reduces memory overhead when analyzing large enterprise repositories. If this optimization continues to validate well in production-scale repositories, similar memory-retention improvements can later be applied to the Python, C#, and Go aggregators as follow-up work.

@somiljain2006 somiljain2006 requested a review from a team as a code owner May 14, 2026 11:14
Signed-off-by: somiljain2006 <somil16022006@gmail.com>
Signed-off-by: somiljain2006 <somil16022006@gmail.com>
@somiljain2006 somiljain2006 force-pushed the Memory-optimization-fix branch from 7268e88 to d1c0e59 Compare May 14, 2026 11:16
@somiljain2006
Copy link
Copy Markdown
Author

@san-zrl Can you please review this pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

High heap memory requirements

1 participant