Skip to content

Commit

Permalink
[3.13] gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391) (
Browse files Browse the repository at this point in the history
…#121392)

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>
  • Loading branch information
miss-islington and jbrobst authored Jul 21, 2024
1 parent 6643524 commit 4b76404
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Python/tracemalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ _PyTraceMalloc_Init(void)

tracemalloc_tracebacks = hashtable_new(hashtable_hash_traceback,
hashtable_compare_traceback,
NULL, raw_free);
raw_free, NULL);

tracemalloc_traces = tracemalloc_create_traces_table();
tracemalloc_domains = tracemalloc_create_domains_table();
Expand Down

0 comments on commit 4b76404

Please sign in to comment.