Skip to content

Conversation

georgebanasios
Copy link
Contributor

@georgebanasios georgebanasios commented Jun 13, 2025

Fixes: #3199

This change addresses a memory leak in the Mono#using, Flux#using, and Flux#usingWhen operators. Currently, their internal subscribers retain a strong reference to the managed resource even after the resourceCleanup action has been executed. This prevents the resource from being garbage collected, leading to potential memory issues.

Also, the issue mentions an example of Flux#fromIterable, which is in combination with Flux#using.
The Flux#using operator is designed for "one-time" use of a resource per subscriber correct?
The Flux#fromIterable is resubscribable which removing the reference to the iterable, changes the design of the operator.

Let me know your thoughts on this approach. I'm happy to make any changes needed.

…m for garbage collection

Signed-off-by: George Banasios <banasiosgeorge@gmail.com>
@georgebanasios georgebanasios requested a review from a team as a code owner June 13, 2025 10:03
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.

Reactor core primitives Flux#using, Flux#usingWhen, Flux#fromIterable should be GC friendly to prevent memory leak
1 participant