Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIXED] Leaking memory on usage of getHash() #4329

Merged
merged 1 commit into from Jul 20, 2023
Merged

[FIXED] Leaking memory on usage of getHash() #4329

merged 1 commit into from Jul 20, 2023

Conversation

derekcollison
Copy link
Member

If we created lots of hashes, beyond server names, like for consumer or stream NRG group names etc, these maps would grow and not release memory. Performance hit is ~300ns per call, and we can use string intern trick if need be at a future date since it is GC friendly.

Signed-off-by: Derek Collison derek@nats.io

Resolves #4289

…or stream NRG groups etc, the maps would grow and not release memory.

In the benchmark on my machine, this added ~300ns per call, but I think that is ok for now vs the memory usage.

Signed-off-by: Derek Collison <derek@nats.io>
@derekcollison derekcollison requested a review from a team as a code owner July 20, 2023 22:36
Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit ba517e4 into main Jul 20, 2023
2 checks passed
@derekcollison derekcollison deleted the fix-4289 branch July 20, 2023 23:04
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.

Leak memory when creating a consumer name with jetstream.
2 participants