[Python-Dev] No longer enable Py_TRACE_REFS by default in debug build

Serhiy Storchaka storchaka at gmail.com
Thu Apr 11 11:30:18 EDT 2019

11.04.19 12:28, Victor Stinner пише:
> Le jeu. 11 avr. 2019 à 07:49, Serhiy Storchaka <storchaka at gmail.com> a écrit :
>> 10.04.19 14:01, Victor Stinner пише:
>>> Disabling Py_TRACE_REFS by default in debug mode reduces the Python
>>> memory footprint. Py_TRACE_REFS costs 2 pointers per PyObject: 16
>>> bytes on 64-bit platforms.
>> Does not the memory allocator in debug mode have even larger cost per
>> allocated block?
> What do you mean? That a debug build already waste too much memory and
> so doesn't deserve to have a smaller memory footprint? I'm not sure
> that I understand your point.

If reducing the Python memory footprint is an argument for disabling 
Py_TRACE_REFS, it is a weak argument because there is larger overhead in 
the debug build.

On other hand, since using the debug allocator doesn't cause problems 
with compatibility, it may be possible to use similar technique for the 
objects double list. Although this is not easy because of objects placed 
at static memory.

More information about the Python-Dev mailing list