I'm still having an issue with a program closing when when it tries to open a data file, in release mode.
Using Erel's code, this is the output of the error, but it doesn't happen when I run it in debug mode.
The error looks like there is an issue grabbing an object through KVS, but that should be the same whether it's in release or debug mode.
I haven't tried to increase the memory available, yet, because I'm tryiung to understand WHY this is happening. The data file it's reading is only 22Kb in size.
What condition(s) would cause a problem with keyvaluestore._getobjectinternal ?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
This is the subroutine that is executing when the error occurs:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Just to clarify, when I say in "relase mode", I mean trying to run the jar directly after having run the IDE in release mode to create the jar. Running it from the IDE, the error doesn't occur.
			
			Using Erel's code, this is the output of the error, but it doesn't happen when I run it in debug mode.
The error looks like there is an issue grabbing an object through KVS, but that should be the same whether it's in release or debug mode.
I haven't tried to increase the memory available, yet, because I'm tryiung to understand WHY this is happening. The data file it's reading is only 22Kb in size.
What condition(s) would cause a problem with keyvaluestore._getobjectinternal ?
			
				B4X:
			
		
		
		keyvaluestore._getobjectinternal (java line: 202)
java.lang.OutOfMemoryError: Java heap space
    at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.readHelper(RandomAccessFile.java:382)
    at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.ReadObject(RandomAccessFile.java:369)
    at b4j.example.keyvaluestore._getobjectinternal(keyvaluestore.java:202)
    at b4j.example.keyvaluestore._getobject(keyvaluestore.java:168)
    at b4j.example.main._loadkvsdata(main.java:625)
    at b4j.example.main._combofilefield_selectedindexchanged(main.java:396)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA$2.run(BA.java:165)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
    at com.sun.javafx.application.PlatformImpl$$Lambda$50/24760006.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Unknown Source)
    at com.sun.javafx.application.PlatformImpl$$Lambda$49/9599617.run(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
    at com.sun.glass.ui.win.WinApplication$$Lambda$38/20085625.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
	This is the subroutine that is executing when the error occurs:
			
				B4X:
			
		
		
		Sub LoadKVSData
    tableDataView.Items.Clear
    Dim listKeys As List
    listKeys.Initialize
    listKeys = kvs.ListKeys
    For i = 0 To listKeys.Size - 1
        Dim Row(2) As Object
        Row(0) = listKeys.Get(i)
        Dim strKeyName As String = listKeys.Get(i)
        strKeyName = strKeyName.ToLowerCase
        If txtPassword.Text <> "" Then
            Try
                Row(1) = kvs.GetEncryptedObject(listKeys.Get(i), txtPassword.Text)
            Catch
                If strKeyName.Contains(".jpg") = True Or strKeyName.Contains(".jpeg") = True Or strKeyName.Contains(".gif") = True Or strKeyName.Contains(".png") = True Or strKeyName.Contains(".bmp") = True Then
                    Dim im As ImageView
                    im.Initialize("im")
                    im.SetImage(kvs.GetBitmap(listKeys.Get(i)))
                    Row(1) = im
               Else
                    Try
                        Row(1) = kvs.GetObject(listKeys.Get(i))
                    Catch
                        Row(1) = kvs.GetSimple(listKeys.Get(i))
                    End Try
                End If
            End Try
        Else
            If strKeyName.Contains(".jpg") = True Or strKeyName.Contains(".jpeg") = True Or strKeyName.Contains(".gif") = True Or strKeyName.Contains(".png") = True Or strKeyName.Contains(".bmp") = True Then
                Dim im As ImageView
                im.Initialize("im")
                im.SetImage(kvs.GetBitmap(listKeys.Get(i)))
                Row(1) = im
           Else
                Try
                    Row(1) = kvs.GetObject(listKeys.Get(i))
                Catch
                    Row(1) = kvs.GetSimple(listKeys.Get(i))
                End Try
            End If
        End If
        tableDataView.Items.Add(Row)
    Next
    refreshTableView
End Sub
Sub refreshTableView
    Dim tempData As List
    tempData.Initialize
    tempData.AddAll(tableDataView.Items)
    tableDataView.Items.Clear
    For i = 0 To tempData.Size - 1
        Dim r() As Object = tempData.Get(i)
        tableDataView.Items.Add(Array As Object(r(0), r(1)))
    Next
    tableDataView.SelectedRow = 0
End Sub
	Just to clarify, when I say in "relase mode", I mean trying to run the jar directly after having run the IDE in release mode to create the jar. Running it from the IDE, the error doesn't occur.