Skip to content

[BugFix] Fix memory leak in count aggregate function registration - #67490

Merged
stdpain merged 1 commit into
StarRocks:mainfrom
alifcapital:fix/count-aggregate-memory-leak
Jan 8, 2026
Merged

[BugFix] Fix memory leak in count aggregate function registration#67490
stdpain merged 1 commit into
StarRocks:mainfrom
alifcapital:fix/count-aggregate-memory-leak

Conversation

@eshishki

@eshishki eshishki commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Count aggregate functions were registered without track_function() wrapper, causing memory leak detected by ASAN. All other aggregate functions in the resolver use track_function() for proper lifecycle management.

Changes:

  • Wrap MakeCountAggregateFunction with track_function()
  • Wrap MakeCountNullableAggregateFunction with track_function()

Why I'm doing:

What I'm doing:

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.0
    • 3.5
    • 3.4
    • 3.3

Note

Ensures count aggregates are lifecycle-tracked to prevent memory leaks, consistent with other aggregates.

  • In aggregate_resolver_sumcount.cpp, wraps MakeCountAggregateFunction<...> and MakeCountNullableAggregateFunction<...> with track_function() in _infos_mapping registrations.

Written by Cursor Bugbot for commit ddf8d6e. This will update automatically on new commits. Configure here.

Count aggregate functions were registered without track_function() wrapper,
causing memory leak detected by ASAN. All other aggregate functions in
the resolver use track_function() for proper lifecycle management.

Changes:
- Wrap MakeCountAggregateFunction with track_function()
- Wrap MakeCountNullableAggregateFunction with track_function()
@eshishki
eshishki requested a review from a team as a code owner January 5, 2026 15:02
@alvin-phoenix-ai

Copy link
Copy Markdown
Contributor

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!

@github-actions

github-actions Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

github-actions Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

github-actions Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

pass : 4 / 4 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exprs/agg/factory/aggregate_resolver_sumcount.cpp 4 4 100.00% []

@stdpain
stdpain merged commit f3848e9 into StarRocks:main Jan 8, 2026
96 of 125 checks passed
farhad-celo pushed a commit to farhad-celo/starrocks that referenced this pull request Jan 20, 2026
…arRocks#67490)

Signed-off-by: Farhad Shahmohammadi <f.shahmohammadi@celonis.com>
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.

4 participants