Skip to content

GH-3794: Use less memory with scheduled tasks #3796

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

Merged
merged 1 commit into from
May 10, 2022

Conversation

artembilan
Copy link
Member

Fixes #3794

  • Replace hard reference to message group with its id in the
    AbstractCorrelatingMessageHandler.removeEmptyGroupAfterTimeout()
  • Replace hard reference to message with its id in the
    DelayHandler.rescheduleAt()

Cherry-pick to 5.5.x

@artembilan
Copy link
Member Author

I'm not sure how to test this therefore I just leave it as is with the conclusion that nothing is broken and that's it.

@garyrussell
Copy link
Contributor

Not really a memory leak, right? Actually "Reduce Memory Usage with Scheduled Tasks"?

@artembilan
Copy link
Member Author

Well, @vfunshteyn-zw called it a "memory leak" because their groups were scheduled for 72 hours.
More content in the group - more memory consumption.

Anyway: we can call it whatever, but better to let GC to do its job and leave the memory for other purposes.

@garyrussell
Copy link
Contributor

Right; I was just concerned that someone browses the change log.

A leak is specifically when some memory is allocated but never released.

In this case, it's unnecessary memory usage that is eventually removed.

I am ok with merging as-is, though, if you like.

@artembilan
Copy link
Member Author

I see. Let me change that commit message then!

Thank you!

Fixes spring-projects#3794

* Replace hard reference to message group with its `id` in the
`AbstractCorrelatingMessageHandler.removeEmptyGroupAfterTimeout()`
* Replace hard reference to message with its `id` in the
`DelayHandler.rescheduleAt()`

**Cherry-pick to `5.5.x`**
@artembilan artembilan changed the title GH-3794: Fix memory leaks with scheduled tasks GH-3794: Use less memory with scheduled tasks May 10, 2022
@artembilan
Copy link
Member Author

Fixed

@garyrussell garyrussell merged commit 9075453 into spring-projects:main May 10, 2022
@garyrussell
Copy link
Contributor

...and cherry-picked.

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.

Memory leak in AbstractCorrelatingMessageHandler
2 participants