B4J Question Out of memory error: Java Heap Space, in jar after compile


Licensed User
I'm trying to read from a KVS file and populate a table view. I get the following error in the released jar, but not in the IDE launced jar (debug or release mode) OR in a windows executable of the jar.

I think this means that an object stored in the KVS file is too big (an image, probably) ... but that's just a guess. But if so, why would it crash the released jar but not the IDE launched jar or the windows exe?

I have no background in java so I have no idea what Java heap space is, or why it would cause the app to be out of memory. Sorry. Noob here.

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:599)
    at b4j.example.main._combofilefield_selectedindexchanged(main.java:380)
    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/7912477.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)


Licensed User
No, I didn't change that attribute. I'll work at nailing down where the memory is getting eaten up.