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(profiling): Do not keep reference to frame #2049

Merged
merged 8 commits into from
Apr 27, 2023

Conversation

Zylphrex
Copy link
Member

The profiler can capture frames from it's own thread. When it does so, it holds on to a reference to the frame in the previous sample. One of the frames it holds on it is a frame from the profiler itself, which prevents the references to other frames to other frames from being freed. A consequence of this is that the local variables of those frames are not able to be freed either. This change ensures we do not keep a reference to the profiler around in order to prevent this issue.

Closes #1980

The profiler can capture frames from it's own thread. When it does so, it holds
on to a reference to the frame in the previous sample. One of the frames it
holds on it is a frame from the profiler itself, which prevents the references
to other frames to other frames from being freed. A consequence of this is that
the local variables of those frames are not able to be freed either. This change
ensures we do not keep a reference to the profiler around in order to prevent
this issue.
sentry_sdk/profiler.py Show resolved Hide resolved
sentry_sdk/_lru_cache.py Show resolved Hide resolved
@Zylphrex Zylphrex marked this pull request as ready for review April 27, 2023 05:11
sentry_sdk/profiler.py Outdated Show resolved Hide resolved
@Zylphrex Zylphrex merged commit bc209e5 into master Apr 27, 2023
@Zylphrex Zylphrex deleted the txiao/fix/do-not-keep-reference-to-frame branch April 27, 2023 16:02
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.

Abnormal memory consumption in celery integration
2 participants