(original) (raw)



On Wed, Apr 10, 2019 at 12:30 PM Nathaniel Smith <njs@pobox.com> wrote:
On Wed, Apr 10, 2019, 04:04 Victor Stinner <vstinner@redhat.com> wrote:
Le mar. 9 avr. 2019 à 22:16, Steve Dower <steve.dower@python.org> a écrit :
\> What are the other changes that would be required?

I don't know.

\> And is there another
\> way to get the same functionality without ABI modifications?

Py\_TRACE\_REFS is a double linked list of \*all\* Python objects. To get
this functionality, you need to store the list somewhere. I don't know
how to maintain such list outside the PyObject structure.

I assume these pointers get updated from some generic allocation/free code. Could that code instead overallocate by 16 bytes, use the first 16 bytes to hold the pointers, and then return the PyObject\* as (actual allocated pointer + 16)? Basically the "container\_of" trick.

I don't think that I ever used sys.getobjects(), whereas many projects
use gc.get\_objects() which is also available in release builds (not
only in debug builds).

Can anyone explain what pydebug builds are... for? Confession: I've never used them myself, and don't know why I would want to.

There is a bunch of extra things done in a debug build, e.g. all freed memory is blanked out with a known pattern so it's easy to tell when you're reading from freed memory (and thus probably messed up your refcounts). And then various extras are tossed on to the sys module to help with things. Basically anything people have found useful and require being compiled in typically get clumped in under the debug build.

-Brett

(I have to assume that most of Steve's Windows downloads are from folks who thought they were downloading a python debugger.)

-n
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/brett%40python.org