This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients christian.heimes, gvanrossum, kumaraditya, miss-islington, sobolevn, vstinner
Date 2022-02-23.18:58:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645642690.26.0.12125581293.issue46430@roundup.psfhosted.org>
In-reply-to
Content
> Sure, but "leaks" caused by deep-freezing cannot be solved by freeing up the deep-frozen memory -- the solution must be to update the accounting somewhere.

Python allocates memory (ex: with PyObject_Malloc()) which is not released at exit. Two examples from Valgrind:

==196803== 50 bytes in 1 blocks are still reachable in loss record 1 of 87
==196803==    at 0x484486F: malloc (vg_replace_malloc.c:381)
==196803==    by 0x544E29: _PyMem_RawMalloc (obmalloc.c:101)
==196803==    by 0x545E0E: PyObject_Malloc (obmalloc.c:700)
==196803==    by 0x587159: PyUnicode_New (unicodeobject.c:1448)
==196803==    by 0x58C4CF: get_latin1_char (unicodeobject.c:2148)
==196803==    by 0x58D7F7: _PyUnicode_FromUCS1 (unicodeobject.c:2450)
==196803==    by 0x58E374: PyUnicode_FromKindAndData (unicodeobject.c:2525)
==196803==    by 0x69402B: r_object (marshal.c:1150)
==196803==    by 0x694295: r_object (marshal.c:1212)
==196803==    by 0x694AE0: r_object (marshal.c:1393)
==196803==    by 0x694295: r_object (marshal.c:1212)
==196803==    by 0x694AA4: r_object (marshal.c:1387)
==196803==    by 0x6950F3: read_object (marshal.c:1524)
==196803==    by 0x6953E7: PyMarshal_ReadObjectFromString (marshal.c:1641)
==196803==    by 0x763223: _Py_Get_Getpath_CodeObject (getpath.c:792)
==196803==    by 0x76337F: _PyConfig_InitPathConfig (getpath.c:847)
==196803==    by 0x68CD04: config_init_import (initconfig.c:1967)
==196803==    by 0x68CE4E: _PyConfig_InitImportConfig (initconfig.c:2000)
==196803==    by 0x69E594: init_interp_main (pylifecycle.c:1103)
==196803==    by 0x69EBF8: pyinit_main (pylifecycle.c:1216)
==196803==    by 0x69EDCE: Py_InitializeFromConfig (pylifecycle.c:1247)
==196803==    by 0x6D5346: pymain_init (main.c:67)
==196803==    by 0x6D64F8: pymain_main (main.c:692)
==196803==    by 0x6D65A1: Py_BytesMain (main.c:725)
==196803==    by 0x41D7B5: main (python.c:15)

and

==196803== 3,336 bytes in 60 blocks are still reachable in loss record 87 of 87
==196803==    at 0x484486F: malloc (vg_replace_malloc.c:381)
==196803==    by 0x544E29: _PyMem_RawMalloc (obmalloc.c:101)
==196803==    by 0x545E0E: PyObject_Malloc (obmalloc.c:700)
==196803==    by 0x587159: PyUnicode_New (unicodeobject.c:1448)
==196803==    by 0x59AEB9: unicode_decode_utf8 (unicodeobject.c:5162)
==196803==    by 0x59B5B0: PyUnicode_DecodeUTF8Stateful (unicodeobject.c:5292)
==196803==    by 0x58D296: PyUnicode_FromString (unicodeobject.c:2322)
==196803==    by 0x5CFFAE: PyUnicode_InternFromString (unicodeobject.c:15650)
==196803==    by 0x4E8B61: descr_new (descrobject.c:885)
==196803==    by 0x4E8C9B: PyDescr_NewMethod (descrobject.c:934)
==196803==    by 0x56694C: type_add_method (typeobject.c:5643)
==196803==    by 0x566A92: type_add_methods (typeobject.c:5689)
==196803==    by 0x569166: type_ready_fill_dict (typeobject.c:6165)
==196803==    by 0x569A02: type_ready (typeobject.c:6421)
==196803==    by 0x569B59: PyType_Ready (typeobject.c:6457)
==196803==    by 0x544363: _PyTypes_InitTypes (object.c:1952)
==196803==    by 0x69D12D: pycore_init_types (pylifecycle.c:704)
==196803==    by 0x69D8FC: pycore_interp_init (pylifecycle.c:831)
==196803==    by 0x69DC31: pyinit_config (pylifecycle.c:887)
==196803==    by 0x69E355: pyinit_core (pylifecycle.c:1050)
==196803==    by 0x69ED32: Py_InitializeFromConfig (pylifecycle.c:1240)
==196803==    by 0x6D5346: pymain_init (main.c:67)
==196803==    by 0x6D64F8: pymain_main (main.c:692)
==196803==    by 0x6D65A1: Py_BytesMain (main.c:725)
==196803==    by 0x41D7B5: main (python.c:15)

Before the commit c0a5ebeb1239020f2ecc199053bb1a70d78841a1, Python didn't leak this memory.
History
Date User Action Args
2022-02-23 18:58:11vstinnersetrecipients: + vstinner, gvanrossum, christian.heimes, miss-islington, sobolevn, kumaraditya
2022-02-23 18:58:10vstinnersetmessageid: <1645642690.26.0.12125581293.issue46430@roundup.psfhosted.org>
2022-02-23 18:58:10vstinnerlinkissue46430 messages
2022-02-23 18:58:10vstinnercreate