mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-46476: Fix memory leak in code objects generated by deepfreeze (GH-30853)
Add _Py_Deepfreeze_Fini() and _PyStaticCode_Dealloc() functions.
This commit is contained in:
parent
ecfacc362d
commit
c7f810b34d
8 changed files with 39 additions and 0 deletions
|
@ -1906,3 +1906,18 @@ _PyCode_ConstantKey(PyObject *op)
|
|||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
void
|
||||
_PyStaticCode_Dealloc(PyCodeObject *co, _Py_CODEUNIT *firstinstr)
|
||||
{
|
||||
PyMem_Free(co->co_quickened);
|
||||
co->co_quickened = NULL;
|
||||
PyMem_Free(co->co_extra);
|
||||
co->co_extra = NULL;
|
||||
co->co_firstinstr = firstinstr;
|
||||
if (co->co_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs((PyObject *)co);
|
||||
co->co_weakreflist = NULL;
|
||||
}
|
||||
co->co_warmup = QUICKENING_INITIAL_WARMUP_VALUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue