-
Notifications
You must be signed in to change notification settings - Fork 5
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
HY-4981 Memory audit #17
Conversation
RavenNumber of Findings: 0 |
General InformationTicket(s): Code Review(s): #17 Additional InformationReviewers: robbecker-wf, patkujawa-wf, georgelesica-wf, smaifullerton-wk
|
Public API ChangesNo changes to the public API found for commit 915c563 Showing results for 915c563
|
lib/src/ruler.dart
Outdated
@@ -35,6 +36,9 @@ class Ruler { | |||
/// The test string to use when measuring | |||
String text; | |||
|
|||
List<StreamSubscription<Event>> _subscriptions = | |||
new List<StreamSubscription<Event>>(); |
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.
IIRC Dart style guide says do <StreamSubscription<Event>>[]
.
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.
ok
@@ -134,12 +138,33 @@ class Ruler { | |||
|
|||
/// Register a callback to be called when the ruler is resized | |||
void onResize(_OnScrollCallback callback) { | |||
_collapsible.onScroll.listen((Event _) { | |||
_subscriptions.add(_collapsible.onScroll.listen((Event _) { |
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.
Two questions...
- Isn't this going to keep accumulating subscriptions as resize events occur? That seems dangerous...
- You could also use
manageStreamSubscription
orlistenToStream
here since it looks like these only get canceled once the dispose method is called
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.
_reset(); | ||
} | ||
|
||
/// Clean up when this ruler is no longer used | ||
void dispose() { |
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.
Is this object actually "disposable"? If so, probably want to use onDispose
. If not, should it be? If the answer is "no", disregard my comment above.
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's not using w_common disposable .. but I could rename this to reduce confusion of people thinking that it may be.
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.
Cool, yeah, I would personally prefer a different name, but only if there's another name that makes sense in this particular context.
Couple comments. |
+1 |
+10
|
Quality Review Approval: +1
@Workiva/release-management-p for merge into master |
+1 from RM |
Overview
This repo needs a memory audit.
Changes
Code was reviewed for memory retention issues. 1 issue was found and fixed.
onScroll StreamSubscriptions are now cancelled for each of the 3 rulers when detecting font load events (only affects browsers that don't have the Font Face API)
Testing / +10
pub serve test
and visithttp://localhost:8080/unload.html