-
Notifications
You must be signed in to change notification settings - Fork 142
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
OutOfMemory exception when showing/hiding GoogleMaps composable #581
Comments
Can be triggered with this minimal example
Stack trace: Process: com.example.memorybug, PID: 10996 |
I am unfortunately not able to reproduce this on the emulator, @dkhawk . Are you using a real device? |
This was on a pixel 6 (IIRC). |
maybe the problem is somewhere in these lines (deleted all but this one in
|
Did you try again after the last release? |
yes |
Using |
I can confirm that wrapping my Composable into |
@dudeck To clarify, I had this in mind: I would not expect the OOM to go away in the above code if you merely wrap it while keeping |
@bubenheimer yes, you are right. I mean when I use like you said it works only if my composable with map is NOT INSIDE a LazyColumn (as LazyListScope item). Otherwise I'm receiving:
I need to place my component inside other list. This exception does not occurs only when I'm wrapping it with a box with set by modifier hardcoded height and when |
LazyColumnn has ReusableComposition built in these days, so I guess an additional |
Thanks, so is it possible to use ReusableComposition to have GoogleMaps composable inside LazyColumn that would get rid off OOM issue or maybe could you suggest other solution ? |
@dudeck not sure without experimenting or digging into impl. I assume LazyColumn would deactivate the reusable composition when an item falls off the radar. That should deactivate an item's Google map, and it would reactivate when the item gets recycled. If you structure your code around this pattern then I'd imagine it would let you avoid OOM. I've never looked at it deeply, though. YMMV |
Environment details
Specify the API at the beginning of the title (for example, "Places: ...")
Google Maps Compose Android
OS type and version
Mac OS Sonoma 14.5
Android API 29 emulator
Library version and other environment information
gms-maps-compose = "com.google.maps.android:maps-compose:5.0.3"
gms-maps-compose-utils = "com.google.maps.android:maps-compose-utils:5.0.3"
Steps to reproduce
Code example
Stack trace
Note:
I checked in Memory Profiler that memory increases from around 350 MB to 450MB and then crashes.
It is easy to reproduce, need some older/low end device (tested on emulators).
It blocks us of releasing feature to the client.
I used your sample code from GoogleMaps repo:https://github.com/googlemaps/android-maps-compose
just modifying by adding Button to change visibility state of Google maps in column.
Could you fix it, please? Or at least give us some temporary quick fix solution?
Thank you in advance.
The text was updated successfully, but these errors were encountered: