>
> However, I still wonder: is there anyway to support `PyTraceMalloc_Track`
> API without being dependent to `tracemalloc`? I know there is not many
> memory tracing tools but I mean I still feel like there should be a generic
> way of doing this: A very vague example for demonstration:
>
> PyMemHooks_GetAllocators/PyMemHooks_SetAllocators/PyMemHooks_TrackAlloc
> which are public APIs and tracemalloc using them internally instead of
> allocator APIs?
>

This can be investigated, but this is equivalent to add tracing support to
the memory allocators and then make tracemalloc a client of such APIs.

This can be advantageous to tool authors but it can raise the maintenance
cost of the allocators as we would need to make these APIs generic enough
as different tools have different constraints (like having to hold the Gil
or not to call these APIs, what information can be passed down (do you want
to know the pointer and the kind of allocator it was used...etc). There are
even tools that want to link the allocated blocks to python objects
directly (which is not possible without a considerable redesign).

I would recommend opening an issue in bugs.python.org where this can be
discussed and (maybe) implemented. Please, feel free to add me to the issue
once open :)

Regards from rainy London,
Pablo Galindo Salgado
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/NDZCL6OB2B535ZXZYVVCFMV4S6RO32GQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to