mirror of
https://github.com/python/cpython.git
synced 2026-06-28 11:50:50 +00:00
[3.13] gh-151065: Copy fix for memory leak from mimalloc upstream (GH-151066) (GH-151385)
Appliesd7a72c4912to our copy of mimalloc. (cherry picked from commit80f9467434) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
e812fe9bc4
commit
8754abc358
2 changed files with 4 additions and 3 deletions
|
|
@ -0,0 +1 @@
|
|||
Fix memory leak when using the :ref:`mimalloc memory allocator <mimalloc>`.
|
||||
|
|
@ -183,9 +183,9 @@ mi_heap_t* _mi_heap_main_get(void) {
|
|||
|
||||
// note: in x64 in release build `sizeof(mi_thread_data_t)` is under 4KiB (= OS page size).
|
||||
typedef struct mi_thread_data_s {
|
||||
mi_heap_t heap; // must come first due to cast in `_mi_heap_done`
|
||||
mi_heap_t heap; // must come first due to cast in `_mi_heap_done`
|
||||
mi_tld_t tld;
|
||||
mi_memid_t memid;
|
||||
mi_memid_t memid; // must come last due to zero'ing
|
||||
} mi_thread_data_t;
|
||||
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ static mi_thread_data_t* mi_thread_data_zalloc(void) {
|
|||
}
|
||||
|
||||
if (td != NULL && !is_zero) {
|
||||
_mi_memzero_aligned(td, sizeof(*td));
|
||||
_mi_memzero_aligned(td, offsetof(mi_thread_data_t,memid));
|
||||
}
|
||||
return td;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue