Make inner class static for CompletableOnErrorComplete #7574
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to RxJava. Before pressing the "Create Pull Request" button, please consider the following points:
After taking a heap dump for a Rx chain that was completed, we saw evidence of inner class showing up on the heap dump analysis. It apears that CompletableOnErrorComplete#onError is leaking the predicate
For instance
class Foo {
fun test(): Completable {
Completable.fromCallable {
println("hello world")
}.onErrorComplete { --> leaks after chain completion
true
}
}
}
Verified with kotlin bytecode dump and heap analysis
Please give a description about what and why you are contributing, even if it's trivial.
Please include the issue list number(s) or other PR numbers in the description if you are contributing in response to those.
Please include a reasonable set of unit tests if you contribute new code or change an existing one. If you contribute an operator, (if applicable) please make sure you have tests for working with an
empty
,just
,range
of values as well as anerror
source, with and/or without backpressure and see if unsubscription/cancellation propagates correctly.