Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(subscriber): fix memory leak from historical
PollOp
s (#311)
## Motivation Currently, `console-subscriber` retains all `PollOp`s that have been recorded since the application started, and sends all of them in the first resource update for a new subscription. I don't think this is correct, for a few reasons. It's necessary to send all currently live tasks and resources to new subscriptions, because future events may reference those tasks or resources. This isn't the case for `PollOp`s --- unlike tasks, resources, and even async ops, a `PollOp` doesn't represent an *object*, it represents an *event*, a single time an object was polled. There's no reason to send all previous poll ops in the first update for a new subscription. Storing all the poll ops that have ever occurred results in a memory leak (see #256); unlike other tracked entities, we never clear anything out of the vector of all poll ops that have ever occurred in the program. ## Solution This branch just removes the `all_poll_ops` `Vec` entirely, and changes the subscriber to only send new poll ops in the first update. We *could* change this so that poll ops are associated with a timestamp, and older ones are cleared out of a vec of all poll ops when they time out. However, the `tokio-console` CLI doesn't currently have a way of showing historical poll ops _anyway_, so there's no reason to keep this data. If that changes, we can put them back, but for now, the simplest solution is to just remove this. Fixes #256
- Loading branch information