Open dudeck opened 3 weeks ago
Can be triggered with this minimal example
class MinimumMapActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
var showMap by remember { mutableStateOf(true) }
val cameraPositionState: CameraPositionState = rememberCameraPositionState() {
position = defaultCameraPosition
}
val uiSettings by remember { mutableStateOf(MapUiSettings(compassEnabled = false)) }
val mapProperties by remember {
mutableStateOf(MapProperties(mapType = MapType.NORMAL))
}
LaunchedEffect(Unit) {
while (true) {
delay(100.milliseconds.toJavaDuration())
showMap = !showMap
}
}
if (showMap) {
GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
properties = mapProperties,
uiSettings = uiSettings,
)
}
}
}
}
Stack trace:
Process: com.example.memorybug, PID: 10996
java.lang.OutOfMemoryError: Failed to allocate a 475987 byte allocation with 245072 free bytes and 239KB until OOM, target footprint 50331648, growth limit 50331648
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at java.nio.DirectByteBuffer$MemoryRef.
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).
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.