Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Does any other open PR do the same thing?
Looks No.
What issue is this PR fixing?
Android app's memory usage climbs high when there are thousands of markers on the map, even though most of the markers uses same image and the images are only around 1KB.
This update is to use a shared image icon for markers when they share the same image URI, instead of loading and creating bitmap within each marker, which uses more memory in case we have a lot of them.
How did you test this PR?
Ideally you should test it with an app that contains a lot of custom markers that shared a small image pool.
To make it simple, we have also created a new page in example app, named "MassiveCustomMarker", which will place 100 custom markers on tap on the map. You can check it out and run the example app. Open android studio profile and watch the memory usage before and after the update while placing more markers on the map.
As a reference, following is the memory profile before the update, tested on Samsung J2 (Samsung SM-G532G). The app crashed on about 500 markers:
Following is the memory profile after the update, Java memory consumption alomost remains constant regardless of the number of markers added. App does not crash even after 1000 markers.