STINNER Victor <vstin...@python.org> added the comment:

> Would it be possible to wrap malloc_print_configure() 
> (https://github.com/PureDarwin/libmalloc/blob/e37056265821cd6e014ab911d9fe3b9d0da88e22/src/malloc_printf.c#L59)
>  in a context manager that we put in test.support? or to override 
> https://github.com/PureDarwin/libmalloc/blob/e37056265821cd6e014ab911d9fe3b9d0da88e22/src/malloc_printf.c#L36?

I don't see much benefit of having a feature which only works on macOS.

You can put a hook on memory allocations using PyMem_SetAllocator() to trigger 
any action you want when any memory allocation done by Python fails.

But is it really an use case to log any memory allocation failure? Python is 
very likely to raise a MemoryError exception in this case. It's well defined, 
no?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40928>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to