Hi,
Just got a crash in my Google Play Console.
Looks like I have too many items in a Map list and caused an out of memory error.
Currently I have no limit on the number of items I am putting in the map, which I think it is causing it to crash since the device got out of memory.
I am thinking of only adding a maximum of 1000 items in the map, and when it gets 1000 in the list remove the oldest item in the map..
However the question I have, what happens if 1000 is still too many? Is there a way to detect if it's reaching the devices memory limit and reduce the amount of items being added to the map ?
Just got a crash in my Google Play Console.
Looks like I have too many items in a Map list and caused an out of memory error.
Currently I have no limit on the number of items I am putting in the map, which I think it is causing it to crash since the device got out of memory.
I am thinking of only adding a maximum of 1000 items in the map, and when it gets 1000 in the list remove the oldest item in the map..
B4X:
If Map.Size > 1000 Then
Dim lastitemKey As Int = Map.GetKeyAt(0)
Map.Remove(lastitemKey)
End If
Map.Put("item,"item")
However the question I have, what happens if 1000 is still too many? Is there a way to detect if it's reaching the devices memory limit and reduce the amount of items being added to the map ?