Skip to content

Comments

Optimize transaction cleanup to prevent memory leaks#1790

Open
wificlub-coder wants to merge 1 commit intodotnetcore:masterfrom
wificlub-coder:dev
Open

Optimize transaction cleanup to prevent memory leaks#1790
wificlub-coder wants to merge 1 commit intodotnetcore:masterfrom
wificlub-coder:dev

Conversation

@wificlub-coder
Copy link

Enhanced the setter of the Transaction property in CapPublisher: when the property is assigned a null value, _asyncLocal.Value is cleared to avoid memory leaks caused by ExecutionContext holding a reference to CapTransactionHolder. Additionally, Transaction = null was added to the finally block of the method to ensure timely release of transactions.

Description:

Provide a more detailed description of the changes made in this PR. Explain the reason behind the changes and their expected impact on the project.

Issue(s) addressed:

  • [Link to the related issue(s), if any]

Changes:

  • List the major changes made in this PR, preferably in bullet points.

Affected components:

  • List the components of the project that are affected by this PR.

How to test:

Provide a step-by-step guide on how to test your changes. Include any relevant information like environment setup, dependencies, etc.

Additional notes (optional):

Provide any additional notes or context that may be relevant to the changes.

Checklist:

  • I have tested my changes locally
  • I have added necessary documentation (if applicable)
  • I have updated the relevant tests (if applicable)
  • My changes follow the project's code style guidelines

Reviewers:

  • Mention any reviewers you would like to review your PR. This can be helpful if you know someone who is familiar with the part of the codebase you're working on.

Enhanced the setter of the Transaction property in CapPublisher: when the property is assigned a null value, _asyncLocal.Value is cleared to avoid memory leaks caused by ExecutionContext holding a reference to CapTransactionHolder. Additionally, Transaction = null was added to the finally block of the method to ensure timely release of transactions.
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.

1 participant