-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Allow finding the source location for GC roots #43025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is the intention to find async stacks of un-awaited Finding await'ers for futures is inherently tied to the specific core libraries used. Finding out where a closure is awaiting (i.e. it's source position) is stored in VM specific metadata. Furthermore we already have such unwinding code in the VM for generating async stacks. It might be best to add a vm-service API to allow querying for un-awaited async stacks. Some time ago I've made a prototype of this, see cl/141603. Now that lazy async stacks (which does the very same unwinding) is being turned on by-default everywhere, it would be a natural step to consider introducing such an API. |
No. The intention is to find the places and reasons that we are "leaking" references to heavy objects. If I can figure out exactly where we have a static field referring to a Future which is holding references to instances that we want to be garbage collected I might be able to refactor into a different pattern. Specifically #42457 and #42458 are two ways that a |
/cc @rmacnak-google |
Tentatively assigning to @aam who moved field state out of |
When using the VM service protocol or the Observatory UI it's possible to track the retaining path of a given object, but once it's traced to a GC root there is no way to get further information or know where in the source code to look for the root.
For instance, a
Future
might hold a reference to arbitrary closures thatawait
it. In Observatory the retaining path would end with something like:I can't find more information about this instance of
_Future
.TheClosure (async_op)
reference can show me the source code containing theawait
. It doesn't tell me whichawait
is interesting (this would also be useful) but it's possible to narrow it down manually. TheFuture
that I'mawait
ing in this instance is not a top level or static variable.Is it possible to find the source code for the static field holding this
_Future
?The text was updated successfully, but these errors were encountered: