Skip to content

Conversation

priesus
Copy link

@priesus priesus commented Oct 8, 2025

We can see the OffsetMapCodecManager being instantiated every second or so, which creates 3 new Meters (Timer, Gauge, Counter) every time.

Because they are referenced from the registeredMeters list in PCMetrics, the duplicate Meters and Tags won't be cleaned up by garbage collection. This creates a significant memory leak over time (issue #859).

This is my first open source contribution, please let me know if this change doesn't make sense or what contribution guidelines I have missed!

Checklist

  • Documentation (if applicable)
  • Changelog

…ecreated every commit confluentinc#859

We can see the OffsetMapCodecManager being instantiated every second or so, which creates 3 new Meters (Timer, Gauge, Counter) every time.

Because they are references from the registeredMeters array in PCMetrics, this creates a significant memory leak over time.
@priesus priesus requested a review from a team as a code owner October 8, 2025 12:15
@priesus
Copy link
Author

priesus commented Oct 8, 2025

To provide additional context:
In our production environment we see that per 24 hours roughly 1 million Meter.Id objects created that are not being garbage-collected. This seems independent of consumer throughput.
image

The problem is that OffsetMapCodecManager gets instantiated a lot and each time the same 3 metrics are created once more.

@priesus
Copy link
Author

priesus commented Oct 10, 2025

@nachomdo or @rkolesnev Are you maybe part of the reviewer group and can have a look at 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.

1 participant