Commit f772800
committed
Fix free-list allocator mismatch for deopted JIT generators (ASAN root cause python#2)
Deopted JIT generators have their type changed from JitGen type to
PyGen_Type during deopt. jitgen_dealloc then routed them to
original_gen_dealloc which calls PyMem_RawFree. But the memory was
allocated from JitGenFreeList's pool (operator new), not malloc.
Fix: always use Cix_gen_dealloc_with_custom_free for ALL generators.
It routes PyObject_GC_Del through Ci_free_jit_list_gen which checks
fromThisArena() and returns pool-allocated generators to the free list
instead of calling PyMem_RawFree.1 parent f8564cc commit f772800
1 file changed
Lines changed: 10 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
49 | 45 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 46 | | |
56 | 47 | | |
57 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
58 | 54 | | |
59 | 55 | | |
60 | 56 | | |
| |||
0 commit comments