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

Fix memory leak in exporter and reader #4224

Merged
merged 11 commits into from
Oct 17, 2024
Merged

Fix memory leak in exporter and reader #4224

merged 11 commits into from
Oct 17, 2024

Conversation

msoltysik
Copy link
Contributor

@msoltysik msoltysik commented Oct 15, 2024

Description

This PR addresses memory leak issue in the exporter and reader by using the weakref library.

The solution, proposed by @aabmass, utilizes weakref.WeakMethod and weakref.WeakSet to ensure proper garbage collection and prevent unintended object retention.

Discussion can be found in the following issue - Fixes #4220

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

It has been covered by a test case.

============================= test session starts ==============================
collecting ... collected 1 item

test_provider_shutdown.py::TestMeterProviderShutdown::test_meter_provider_shutdown_cleans_up_successfully PASSED [100%]

============================== 1 passed in 0.08s ===============================

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@msoltysik msoltysik requested a review from a team as a code owner October 15, 2024 16:55
Copy link

linux-foundation-easycla bot commented Oct 15, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@xrmx
Copy link
Contributor

xrmx commented Oct 16, 2024

@msoltysik please fix ruff failure

@msoltysik
Copy link
Contributor Author

Hey @xrmx , I've just applied tox -e ruff

Copy link
Member

@emdneto emdneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The test fails against main. LGTM

@lzchen lzchen merged commit 5de1ccb into open-telemetry:main Oct 17, 2024
347 checks passed
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.

Unable to release memory
4 participants