Hi,
I got this exception on a 2Gb Android10 tablet and not on a 4Gb Android14. It is not always on the same function. I checked all Cursors are closed after use. What can I do to prevent this from happening or do I have to request tablets with 4Gb or more memory?
The complete message:
android.database.CursorWindowAllocationException: Cursor window allocation of 2097152 bytes failed. # Open Cursors=701 (# cursors opened by this proc=701)
One of the functions where it happens:
This function loads 700 rows. As you can see I tried to split the dataload into 2 Queries.
I hope someone can advice me where to start.
Kind regards,
André
I got this exception on a 2Gb Android10 tablet and not on a 4Gb Android14. It is not always on the same function. I checked all Cursors are closed after use. What can I do to prevent this from happening or do I have to request tablets with 4Gb or more memory?
The complete message:
android.database.CursorWindowAllocationException: Cursor window allocation of 2097152 bytes failed. # Open Cursors=701 (# cursors opened by this proc=701)
One of the functions where it happens:
B4X:
Sub VullenContainers
ContainerList.Initialize
ContainerNaam.Initialize
ContainerType.Initialize
TarraList.Initialize
AantalList.Initialize
CheckList.Initialize
ContainerList.Clear
ContainerNaam.Clear
ContainerType.Clear
TarraList.Clear
AantalList.Clear
CheckList.Clear
Try
Dim SenderFilter As Object = Main.SQL1.ExecQueryAsync("SQL","SELECT Code, Type FROM "&Main.DBContainers&" ORDER BY Type, Code", Null)
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, cr As Cursor)
If Success Then
For i = 0 To cr.RowCount - 1
cr.Position=i
Dim cont As Cursor
cont = Main.SQL1.ExecQuery("SELECT Omschrijving, Tarra FROM "&Main.DBContainers&" WHERE Type="&cr.GetString("Type")&$" AND Code=""$&cr.GetString("Code")&$"""$)
cont.Position=0
ContainerList.Add(cr.GetString("Code"))
ContainerNaam.Add(cont.GetString("Omschrijving"))
TarraList.Add(cont.GetString("Tarra"))
ContainerType.Add(cr.GetString("Type"))
AantalList.Add("")
CheckList.Add(False)
If(Hoofdscherm.Terug=True) Then
For x = 0 To Hoofdscherm.ConTerug.Size-1
If(Hoofdscherm.ConTerug.Get(x)=cr.GetString("Code")) Then
AantalList.Set(i,Hoofdscherm.AantalConTerug.Get(x))
CheckList.Set(i,True)
Exit
End If
Next
Else
For x = 0 To Hoofdscherm.Containers.Size-1
If(Hoofdscherm.Containers.GetKeyAt(x)=cr.GetString("Code")) Then
AantalList.Set(i,Hoofdscherm.AantalContainer.Get(x))
CheckList.Set(i,True)
Exit
End If
Next
End If
cont.Close
Next
End If
Catch
Starter.ZendError("module=VullenContainers&error=("&cr.RowCount&")"&LastException)
End Try
cr.Close
LaadContainers("")
EigenFuncties.ResetUserFontScale(Activity)
End Sub
This function loads 700 rows. As you can see I tried to split the dataload into 2 Queries.
I hope someone can advice me where to start.
Kind regards,
André