Hi there,

Since Python 3.4, once can replace easily the Python memory allocators
via the C API with its own copy
(https://docs.python.org/3/c-api/memory.html#customize-memory-allocators).

This is a great feature for implementing performance optimizations or
profiling. This has given the ability to build powerful tools such as
tracemalloc!

However, there's one cruelly missing feature.

The API only gives you access to the number of bytes to allocate and
later to the pointer to free. It would be really useful to have more
context about the allocation itself.
For example, one piece of information that would be really useful is to
have the type that is being allocated. This would allow profilers, such
as tracemalloc, to get more information about the allocated type, and
not only a number of bytes in order to help debugging or building
statistics.

I doubt this is currently doable without changing or adding a new C API
unfortunately.

Thoughts?

-- 
Julien Danjou
// Free Software hacker
// https://julien.danjou.info
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SLDL3V7622ESPVW5XQBCXH3IG7OCLWIJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to