-
Notifications
You must be signed in to change notification settings - Fork 264
Description
I'm one of the maintainers of the Memray memory profiler. We recently got a bug report that's essentially a feature request in disguise: to support greenlet.
We've been researching what it would take for us to be able to support greenlet, and we think it's almost reasonable for us to support it, but there's one piece missing. Specifically, if someone uses the Memray API to start tracing in an application that has already spawned some threads, we have no way to call the (thread-specific) greenlet.settrace() function in each of the existing threads, which can lead to allocations being attributed to the wrong stack.
It would be very helpful if greenlet could either a) provide a way to install a global trace function that's called from every thread (or possibly every thread where no thread-local trace function has been installed), or b) provide a way to set the thread-local trace function on all existing threads. (Presumably (a) is much more reasonable to implement than (b), but either would work for our needs.)