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

Memory leak in tracemalloc #121390

Closed
jbrobst opened this issue Jul 5, 2024 · 1 comment
Closed

Memory leak in tracemalloc #121390

jbrobst opened this issue Jul 5, 2024 · 1 comment
Labels
type-bug An unexpected behavior, bug, or error

Comments

@jbrobst
Copy link
Contributor

jbrobst commented Jul 5, 2024

Bug report

Bug description:

The tracemalloc_tracebacks hash table has traceback keys and NULL values, but its destructors do not reflect this -- key_destroy_func is NULL while value_destroy_func is raw_free. The leaked traceback keys can be seen with AddressSanitizer:

./configure --with-pydebug --with-address-sanitizer
make -j "$(nproc)"
./python -X tracemalloc -c 'print("hello there")'

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

@jbrobst jbrobst added the type-bug An unexpected behavior, bug, or error label Jul 5, 2024
vstinner pushed a commit that referenced this issue Jul 5, 2024
The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 5, 2024
…1391)

The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
(cherry picked from commit db39bc4)

Co-authored-by: Josh Brobst <jbrobst@proton.me>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 5, 2024
…1391)

The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
(cherry picked from commit db39bc4)

Co-authored-by: Josh Brobst <jbrobst@proton.me>
@vstinner
Copy link
Member

vstinner commented Jul 5, 2024

Fixed by db39bc4.

@vstinner vstinner closed this as completed Jul 5, 2024
vstinner pushed a commit that referenced this issue Jul 5, 2024
…#121393)

gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391)

The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
(cherry picked from commit db39bc4)

Co-authored-by: Josh Brobst <jbrobst@proton.me>
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants