OutOfMemory error during compilation

Sortec

Member
Licensed User
Longtime User
Dear Community,


I have a substantial-sized project, composed of:
  • 54 code modules
  • 70 classes
  • 43 activities
  • 7 image files (png)
  • 45 layouts
  • 16 referenced libraries

Adding the 54th code module gave me the following compilation error:

Parsing code. 0.68
Compiling code. 1.43
Compiling layouts code. 0.01
Generating R file. 0.09
Compiling generated Java code. 5.43
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL ERROR:Exception in thread "main"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"
Optimized dexer failed. Switching to Standard dexer.


  • It has been switching to the standard dexer for the last 30minutes (and is still going)
  • I removed the last code module and added a new empty one as a small test, and it still refused to compile.
  • Switching from debug to release mode compiles, albeit very slowly.

Have I reached the limit of B4A, and if so is there something we can do about it?


Kind regards,
Nicholas


PS. My machine specs are:
  • Genuine Intel i5-3570K CPU @ 3.4Ghz
  • 16GB RAM
  • Windows 7 64bit SP1
 
Last edited:

Sortec

Member
Licensed User
Longtime User
You might need to edit the b4aV0.1.ini file (look in your Windows profile) and change the line MaxRamForDex=512 for a higher value

You are brilliant. This solved the problem. Thank you!

I found the b4aV0.1.ini file here on my machine:
  • C:\Users\nicholas\AppData\Roaming\Anywhere Software\Basic4android

I replaced the line:
  • MaxRamForDex=512
to:
  • MaxRamForDex=8192
 
Last edited:
Upvote 0

Sortec

Member
Licensed User
Longtime User
If a mod could rename this thread to "OutOfMemory error during compilation", I think it will help more people.
 
Upvote 0

TheMightySwe

Active Member
Licensed User
Longtime User
Not that many programs will hit the ceiling i guess, but maybe an easy way to set that setting would be nice.
 
Upvote 0
Top