-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Instrument Image and Picture for leak tracking. #35274
Conversation
@yjbanov , can you advise, please - is it right understanding that I need to add instrumentation both in lib/ui and in lib/web_ui? |
The API should be identical, but if leak tracking a VM-only feature that doesn't have an equivalent in dart2js/DDC, then the web version can remain a noop. |
Gold has detected about 37 new digest(s) on patchset 21. |
|
||
ui.Image.onCreate = null; | ||
// TODO(polina-c): unskip the test when bug is fixed: | ||
// https://github.com/flutter/engine/pull/35791 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#35791 is now merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was wrong URL. Replaced with right one. The issue is not fixed yet.
|
||
ui.Image.onDispose = null; | ||
// TODO(polina-c): unskip the test when bug is fixed: | ||
// https://github.com/flutter/engine/pull/35791 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -1681,6 +1700,7 @@ class Image { | |||
/// useful when trying to determine what parts of the program are keeping an | |||
/// image resident in memory. | |||
void dispose() { | |||
onDispose?.call(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and elsewhere: can we guard calling these so it's compiled out of release mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I know there is no compile time flags (like bool.fromEnvironment('flutter.memory_allocations')) in engine.
And 'normal' flags will not be more efficient both from performance perspective and code size perspective, than comparison to null. So there is no point in such guarding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline - any flag we put in here would be at best a runtime check that's probably no faster than the null check here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See go/dart-leaktracker-productization.
Before merging to https://github.com/flutter/engine/tree/main/lib: