Skip to content
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

Expose vm service API to give me ObjRef by object. #53012

Closed
polina-c opened this issue Jul 22, 2023 · 9 comments
Closed

Expose vm service API to give me ObjRef by object. #53012

polina-c opened this issue Jul 22, 2023 · 9 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug vm-service The VM Service Protocol, both the specification and its implementation

Comments

@polina-c
Copy link
Contributor

It is needed for leak_tracker.

So that it does not have to full scan all instances searching for hash code.
This will also simplify the leak tracker code, as it will not have to account for possible hash code duplicates

@polina-c
Copy link
Contributor Author

polina-c commented Jul 22, 2023

@lrhn lrhn added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Jul 22, 2023
@a-siva a-siva added the vm-service The VM Service Protocol, both the specification and its implementation label Jul 24, 2023
@a-siva a-siva added type-enhancement A request for a change that isn't a bug P2 A bug or feature request we're likely to work on labels Jul 24, 2023
@polina-c
Copy link
Contributor Author

Current implementation of object lookup: https://github.com/dart-lang/leak_tracker/blob/10cce1af65da33daf8268e82ca6e4557235c1a25/pkgs/leak_tracker/lib/src/leak_tracking/retaining_path/_retaining_path.dart#L57

Instead I want to pass object, that I can keep with weak reference.

@polina-c
Copy link
Contributor Author

polina-c commented Aug 27, 2023

In order to invoke service.getRetainingPath, I need isolateId as well. Is there a way to get it for an object? If no, is it possible to expose Service.getIsolateIdForObject as well?

@bkonyi
Copy link
Contributor

bkonyi commented Aug 28, 2023

possible

You're looking for Service.getIsolateId.

@derekxu16
Copy link
Member

I think you also need Isolate.current from dart:isolate (https://api.flutter.dev/flutter/dart-isolate/Isolate/current.html).

@polina-c
Copy link
Contributor Author

possible

You're looking for Service.getIsolateId.

It wants Isolate as parameter

@bkonyi
Copy link
Contributor

bkonyi commented Aug 28, 2023

Yes, you can get that with Isolate.current as Derek pointed out.

@polina-c
Copy link
Contributor Author

I think you also need Isolate.current from dart:isolate (https://api.flutter.dev/flutter/dart-isolate/Isolate/current.html).

I tried to use it and got confused.
getRetainingPath wants String isolateId, while I do not see anything close in the Isolate in dart:isolate: https://api.flutter.dev/flutter/dart-isolate/Isolate-class.html

@derekxu16, can you help me to figure this out?

@derekxu16
Copy link
Member

Service.getIsolateId(Isolate.current) should give you the string you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug vm-service The VM Service Protocol, both the specification and its implementation
Projects
None yet
Development

No branches or pull requests

5 participants