Android Question Out of Memory Error

vbmundo

Well-Known Member
Licensed User
Hi,

I have running in Debug mode my new APP

But I receive this error when I try to run an simply SQL Statement

B4X:
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:SuperMySQL.Pro
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (mysql) Create **
** Service (mysql) Start **
Raising.. schema_status
Connected to Database
** Activity (main) Pause, UserClosed = false **
** Activity (listatablas) Create, isFirst = true **
** Activity (listatablas) Resume **
** Activity (listatablas) Pause, UserClosed = false **
** Activity (querymanager) Create, isFirst = true **
Raising.. tables_status
Connected to Database
** Activity (querymanager) Resume **
** Activity (querymanager) Pause, UserClosed = false **
** Activity (query) Create, isFirst = true **
** Activity (query) Resume **
ReConnecting
Raising.. schema_status
Auto-Reconnect Attempt #1 of 15
Raising.. schema_status
Database connection re-established
Raising.. schema_status
** Activity (query) Pause, UserClosed = false **
** Activity (resultadoselect) Create, isFirst = true **
** Activity (resultadoselect) Resume **
java.lang.OutOfMemoryError: Failed to allocate a 184566861 byte allocation with 8388608 free bytes and 15MB until OOM
    at anywheresoftware.b4a.shell.ShellConnector.readObject(ShellConnector.java:280)
    at anywheresoftware.b4a.shell.ShellConnector.readList(ShellConnector.java:221)
    at anywheresoftware.b4a.shell.Shell.getStateAfterUserSub(Shell.java:495)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:403)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:259)
    at SuperMySQL.Pro.table._showrow(table.java:844)
    at SuperMySQL.Pro.table._addrow(table.java:481)
    at SuperMySQL.Pro.resultadoselect._muestrotabla(resultadoselect.java:664)
    at SuperMySQL.Pro.resultadoselect._tablessql_result(resultadoselect.java:426)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:315)
    at anywheresoftware.b4a.debug.Debug.CallSubNew3(Debug.java:285)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug3(Common.java:862)
    at SuperMySQL.Pro.mysql._tables_queryresult(mysql.java:651)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA$2.run(BA.java:328)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5593)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Error occurred on line: 619 (Table)
java.lang.RuntimeException: Unexpected command: 110
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:415)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:259)
    at SuperMySQL.Pro.table._showrow(table.java:844)
    at SuperMySQL.Pro.table._addrow(table.java:481)
    at SuperMySQL.Pro.resultadoselect._muestrotabla(resultadoselect.java:664)
    at SuperMySQL.Pro.resultadoselect._tablessql_result(resultadoselect.java:426)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:315)
    at anywheresoftware.b4a.debug.Debug.CallSubNew3(Debug.java:285)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug3(Common.java:862)
    at SuperMySQL.Pro.mysql._tables_queryresult(mysql.java:651)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA$2.run(BA.java:328)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5593)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

184 mb ? my SQL statement only read 44 rows..

If I run this with F8 Debug line by line and works fine.

I don't know if the TABLE class is the problem

this is the code of FlexGrid Table when error appears

B4X:
Public Sub AddRow(Values() As String)
    Try
        If Values.Length <> NumberOfColumns Then
            Log("Wrong number of values =" & Values.Length & " col=" & NumberOfColumns)
            Return
        End If
        Data.Add(Values)
        Dim lastRow As Int
        lastRow = Data.Size - 1
        If lastRow < (SV.VerticalScrollPosition + SV.Height) / cRowHeight + 1 Then
            ShowRow(lastRow)       
        End If
        SV.Panel.Height = Data.Size * cRowHeight
        updateIPLocation
        If (lblStatusLine.IsInitialized And enableStatusLineAutoFill=True) Then setStatusLine(Data.Size & " rows") ' should this be automatic ?
       
    Catch
        Log(LastException)
    End Try
End Sub


ShowRow(lastRow)

Regards
 

bgsoft

Well-Known Member
Licensed User
Longtime User
Hi, Pablo

Sometimes in debug mode it gives you an error where you have it controlled by a Try/Catch, but the program is still running, is this your case?

If you try and tell you Erel in release mode and does not give you the error, do not worry about do it in debug mode

regards
 
Upvote 0

vbmundo

Well-Known Member
Licensed User
Hi, Pablo

Sometimes in debug mode it gives you an error where you have it controlled by a Try/Catch, but the program is still running, is this your case?

If you try and tell you Erel in release mode and does not give you the error, do not worry about do it in debug mode

regards

No, my project stop after this error...

But in Release mode work fine.

Thanks
 
Upvote 0
Top