Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db39bc4

Browse files
authored
gh-121390: tracemalloc: Fix tracebacks memory leak (#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.
1 parent cb688ba commit db39bc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/tracemalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ _PyTraceMalloc_Init(void)
838838

839839
tracemalloc_tracebacks = hashtable_new(hashtable_hash_traceback,
840840
hashtable_compare_traceback,
841-
NULL, raw_free);
841+
raw_free, NULL);
842842

843843
tracemalloc_traces = tracemalloc_create_traces_table();
844844
tracemalloc_domains = tracemalloc_create_domains_table();

0 commit comments

Comments
 (0)