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

SpliceFlatStreamToMetaSingle: avoid returning a static Throwable #2253

Merged
merged 1 commit into from
Jun 17, 2022

Conversation

idelpivnitskiy
Copy link
Member

Motivation:

The processing chain can add suppressed exceptions. If we return a
static instance of a Throwable, it can lead to a memory leak.

Modifications:

  • Make H2ClientParentConnectionContext.StacklessCancellationException
    pkg-private;
  • Create a new StacklessCancellationException instead of always
    returning the same static instance;

Result:

No possibility for a memory leak in a static Throwable instance.

Motivation:

The processing chain can add suppressed exceptions. If we return a
static instance of a `Throwable`, it can lead to a memory leak.

Modifications:

- Make `H2ClientParentConnectionContext.StacklessCancellationException`
pkg-private;
- Create a new `StacklessCancellationException` instead of always
returning the same static instance;

Result:

No possibility for a memory leak in a static `Throwable` instance.
@idelpivnitskiy idelpivnitskiy self-assigned this Jun 16, 2022
@idelpivnitskiy idelpivnitskiy merged commit de5dca6 into apple:main Jun 17, 2022
@idelpivnitskiy idelpivnitskiy deleted the static-throwable branch June 17, 2022 00:48
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.

2 participants