https://github.com/python/cpython/commit/4b76404a511c287a73e32eef927f7cc4377d3055
commit: 4b76404a511c287a73e32eef927f7cc4377d3055
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2024-07-21T13:12:13Z
summary:

[3.13] gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391) (#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 db39bc42f90c151b298f97b780e62703adbf1221)

Co-authored-by: Josh Brobst <[email protected]>

files:
M Python/tracemalloc.c

diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c
index fee7dd0e56d96d..e58b60ddd5e484 100644
--- a/Python/tracemalloc.c
+++ b/Python/tracemalloc.c
@@ -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();

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to