[Python-Dev] No longer enable Py_TRACE_REFS by default in debug build
On 11Apr2019 0228, Victor Stinner wrote:
> 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.
He means you're micro-optimising something that doesn't matter. If you
really wanted to reduce memory usage in debug builds, you'd go after one
of the bigger "problems".
> A smaller footprint can mean that more people may be able to use debug
> build. Disabling Py_TRACE_REFS should make Python a little bit faster.
This isn't one of the goals of a debug build though, and you haven't
pointed at any examples of people not being able to use the debug build
because of memory pressure. (Which is because most people who are not
working on CPython itself should not be using the debug build.)
> My question stands: is it worth to keep a feature which "waste"
> resources (memory footprint and CPU) and nobody uses it?
You haven't even tried to show that nobody uses it, other than pointing
out that it exposes a crash due to a refcounting bug (which is kind of
the point ;) ).