B4J Question system.outofmemoryexception

Hi All,

Not sure if any of you have had this issue and know how to fix it: Exception of type 'System.OutOfMemoryException' was thrown... See below:

system.outofmemoryexception.png


This one happens during compilation.

These other errors below happen when I am editing/saving the code while the program is running in debug mode.
The exception is thrown randomly on different parts of the code.
The IDE has to be exited and restarted to carry on working, otherwise it lags and freezes.
Our program runs beautifully, so not sure what is the problem. Are there limits to the size of the program, when compiled in release mode the jar file is nearly 32megabytes?

error 4.png


error3.png


error2.png


Error.png


The IDE also randomly logged these incorrect errors in the logs(they are not there the next time that you restart the IDE)

errors in logs not right.png


Any help to get rid of this problem will be greatly appreciated.
 

MegatenFreak

Active Member
Licensed User
The RAM consumption doesn't have anything to do with the size of the compiled app.
We might be able to help with some more information:
When you get the out of memory error, check Task Manager to see the memory usage state:
1. Press CTRL+SHIFT+ESC
2. In the performance tab, tell us how much memory you have "Available"
3. In the Processes tab, click the word 'memory' at the top of its column to sort apps based on memory usage. What do you have at the top rows? What is using so much RAM?
 
Upvote 0
2. In the performance tab, tell us how much memory you have "Available"
There is around 5.8 GB available when the error happens. Another computer that we have has around 32 GB of RAM in total and the error happens on that machine to.


What is it and how much RAM does it have. Is it a 32bit machine?
The machine that I am using has 12 GB of RAM installed. All our machines are 64bit Windows 10.
 
Upvote 0

MegatenFreak

Active Member
Licensed User
In that case, it has to be something in the code.
My guess is that somewhere in your code there is a faulty TRY/CATCH statement. Check them out throughout your code. Make sure the following structure is preserved:
B4X:
Try
    'code here
Catch
    'Catch the exception, use this to log it:
    Log(LastException)
End Try
If the problem persists regardless of the code, I'd personally uninstall/reinstall Java and B4J.
 
Upvote 0

kimstudio

Active Member
Licensed User
Longtime User
I am curious on how large your project is seeing the line number 12600, which triggers a question on the code file size/max lines supported❓
 
Upvote 0
Hi All,
I have been looking into the above errors again as it is bugging us and making it almost impossible to work in the IDE.
I have some more information to get you all in the right direction so that I can get the IDE working properly again.
Seems like it could be a problem with the .net library(I have the lastest B4J IDE and the latest .net library I think it is 6.0.2, though it says (CLR v4.0.30319: B4J.exe) in the error messages that I have attached, maybe it is using that version??)
I have been using the debugging that is mentioned in this link https://www.b4x.com/android/forum/threads/b4a-choose-just-in-time-debugger.137264/
I have attached a text file with the errors that came up.

Kind Regards
Christopher
 

Attachments

  • This is the source issue for b4j IDE error.txt
    10.4 KB · Views: 187
Upvote 0

agraham

Expert
Licensed User
Longtime User
the latest .net library I think it is 6.0.2, though it says (CLR v4.0.30319: B4J.exe)
You might be thinking of .NET Core, the cross platform version of .NET, which is at version 6 with version 7 in beta. Your desktop has the Windows only .NET Framework, probably version 4.8 if it is up to date.

Other people have suffered similar and the concensus is that you are hitting the 2GB per process memory limit of a 32bit windows program. Erel has said that he will switch the IDEs to 64 bit this year.
 
Upvote 0
Thank you very much for your reply, this is leading us in the right direction.
I look forward to the 64bit version, then I hope our problems will be sorted out.
 
Upvote 0
Top