[Python-Dev] Re: Custom memory profiler and PyTraceMalloc_Track

2022-02-15 Thread Pablo Galindo Salgado
> > 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: > >

[Python-Dev] Re: Custom memory profiler and PyTraceMalloc_Track

2022-02-15 Thread Sümer Cip
> In other words, the allocators are concerned about > memory, not tracing or anything else that can be done by overriding them. Ok I now understand that `tracemalloc`'s use of allocator APIs is just an implementation detail. Allocator APIs were used for tracing but they are not designed for

[Python-Dev] Re: Custom memory profiler and PyTraceMalloc_Track

2022-02-15 Thread Pablo Galindo Salgado
The memory allocators don't have any context of tracing, they just allocate. Tracemalloc is a trampoline based allocator that also trace what's going on, bit from the point of view of the python allocator system is just another allocator. There is no concept of "notify the python allocator"