Skip to content

Cache duration Pattern in GenerationalHeapParser CMS remark path - #579

Open
Hashim Khan (Hashim1999164) wants to merge 2 commits into
microsoft:mainfrom
Hashim1999164:fix/cache-duration-group-pattern-567
Open

Cache duration Pattern in GenerationalHeapParser CMS remark path#579
Hashim Khan (Hashim1999164) wants to merge 2 commits into
microsoft:mainfrom
Hashim1999164:fix/cache-duration-group-pattern-567

Conversation

@Hashim1999164

@Hashim1999164 Hashim Khan (Hashim1999164) commented Aug 12, 2026

Copy link
Copy Markdown

Summary

splitRemarkReferenceWithWeakReferenceSplitBug recompiled Pattern.compile(".* " + PAUSE_TIME) on every call. That matches other parser patterns that already use static final compiled patterns.

This change introduces DURATION_GROUP_PATTERN and reuses it for matching.

Fixes #567

Test plan

  1. ./mvnw -pl parser -am -DskipTests compile
  2. Optional: run parser tests that cover CMS remark / weak reference split bug lines

Compile DURATION_GROUP_PATTERN once as a static final field instead of
on every CMS remark weak-reference split parse call.
Fixes microsoft#567.
Replace greedy .* with a line bounded prefix so matcher.find still
selects the last pause time. Guard null parse results that SonarCloud
flags as reliability bugs.
@sonarqubecloud

Copy link
Copy Markdown

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.

Parser bug: Pattern.compile() called per-invocation in GenerationalHeapParser.splitRemarkReferenceWithWeakReferenceSplitBug

1 participant