Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The current code calls DdtraceProfilerEventLoopPolicy.clear_threads each time a task is resolved, which can be up to 100 times a second. This is way too much and we don't expect for the thread->loop mapping to change that often. Instead we often try to clear the mapping when a new loop is attached to a thread. In a regular application, this is the expected workflow: a thread appears and gets a new loop, so we clear the old ones. The worst case scenario would be an app spawning 100 threads with 100 loops and then not doing that ever again, which would make the profiler keep a reference on the 100 loops — until a new loop is attached, which if never, would kept the reference forever. Since this far from being a common pattern, it should be safe to switch to a simpler model like this. (cherry picked from commit f583fec) Co-authored-by: Julien Danjou <[email protected]>
- Loading branch information