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 Michael.Felt, corona10, erlendaasland, miss-islington, rhettinger, ronaldoussoren, shihai1991, vstinner
Date 2022-01-27.01:10:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643245854.87.0.509310361356.issue40170@roundup.psfhosted.org>
In-reply-to
Content
I searched for "_PyObject_DebugMallocStats" in top 5000 PyPI projects. There is a single project using it: guppy3.

Extract of guppy3 src/heapy/xmemstats.c:

...
    dlptr__PyObject_DebugMallocStats = addr_of_symbol("_PyObject_DebugMallocStats");
...
static PyObject *
hp_xmemstats(PyObject *self, PyObject *args)
{
    if (dlptr__PyObject_DebugMallocStats) {
        fprintf(stderr, "======================================================================\n");
        fprintf(stderr, "Output from _PyObject_DebugMallocStats()\n\n");
        dlptr__PyObject_DebugMallocStats(stderr);
    }
    ...
}

addr_of_symbol() is implemented with dlsym() or GetModuleHandle(NULL)+GetProcAddress(): it searchs for the symbol in the current process.
History
Date User Action Args
2022-01-27 01:10:54vstinnersetrecipients: + vstinner, rhettinger, ronaldoussoren, Michael.Felt, corona10, miss-islington, shihai1991, erlendaasland
2022-01-27 01:10:54vstinnersetmessageid: <1643245854.87.0.509310361356.issue40170@roundup.psfhosted.org>
2022-01-27 01:10:54vstinnerlinkissue40170 messages
2022-01-27 01:10:54vstinnercreate