-
Notifications
You must be signed in to change notification settings - Fork 318
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
Fix memory leak due to builder with Context in constructor #3023
Conversation
3fd8e1f
to
5a2743f
Compare
Codecov Report
@@ Coverage Diff @@
## master #3023 +/- ##
============================================
- Coverage 36.76% 36.75% -0.02%
Complexity 2216 2216
============================================
Files 554 554
Lines 19955 19955
Branches 1886 1886
============================================
- Hits 7337 7334 -3
- Misses 11782 11784 +2
- Partials 836 837 +1 |
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.
Thanks for the quick fix @kmadsen
0e05c82
to
1f396cf
Compare
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.
Left a couple of minor comments.
libnavigation-core/src/main/java/com/mapbox/navigation/core/internal/MapboxDistanceFormatter.kt
Outdated
Show resolved
Hide resolved
* @param locale the locale to use for localization of distance resources | ||
* @param unitType to use, or UNDEFINED to use default for locale country | ||
* @param roundingIncrement increment by which to round small distances | ||
* @param builder used for updating options | ||
*/ | ||
class MapboxDistanceFormatter private constructor( |
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.
From #2709 (comment)
For example, MapboxDistanceFormatter will be renamed to DistanceFormatOptions which can be passed to components requiring distance formatting.
Do we still want to do that? Maybe in a separate ticket?
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.
Yeah finding MapboxDistanceFormatter to be a larger project. So the progress can be tracked here #3016
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.
MapboxDistanceFormatter is a service, so renaming to DistanceFormatOptions actually doesn't make sense. updating the source ticket
816b150
to
4d9041f
Compare
4d9041f
to
619e9db
Compare
Description
Removing the builder from the constructor. It's not a good idea to add the Context to the builder because it creates memory leaks.Taking @Guardiola31337 suggestion to throw it in the build(..) function. That function converts the context to an applicationContext to save memory leaks.This issue was introduced here #3015
There is an outstanding issue for refactoring the MapboxDistanceFormatter #3016
bug
,feature
,new API(s)
,SEMVER
, etc.)Testing
Please describe the manual tests that you ran to verify your changes
SNAPSHOT
upstream dependencies if needed) through testapp/demo app and run all activities to avoid regressionsChecklist
CHANGELOG
including this PR