stefanoa Active Member Licensed User Longtime User Jan 22, 2012 #1 ..... Generating R file. 0.00 Compiling generated Java code. 5.07 Convert byte code - optimized dex. Error UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2760) at java.util.Arrays.copyOf(Arrays.java:2734) ........ what's the problem??? :sign0085: thanks
..... Generating R file. 0.00 Compiling generated Java code. 5.07 Convert byte code - optimized dex. Error UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2760) at java.util.Arrays.copyOf(Arrays.java:2734) ........ what's the problem??? :sign0085: thanks
S SiriusCG Member Licensed User Longtime User Jan 22, 2012 #2 There are a few possibilities but the most common is creating an array that is too large for the heap space (allocated memory) to contain. You can do a couple of things: check your code to make sure your arrays aren't bigger than you need and that your code is correct. If your code is correct or you can't change it, about the only other thing you can do is increase the heap space: Start the application with the command line switch: -XmxSizeUnits for example: To set a max heap size of 128Mb use: java -Xmx128m To set a max heap size of 640kb use: java -Xmx640k I'm new to B4A, so I don't know yet how to change the java compiler directives from inside the IDE. Perhaps someone else can provide that info .. Cheers Last edited: Jan 22, 2012 Upvote 0
There are a few possibilities but the most common is creating an array that is too large for the heap space (allocated memory) to contain. You can do a couple of things: check your code to make sure your arrays aren't bigger than you need and that your code is correct. If your code is correct or you can't change it, about the only other thing you can do is increase the heap space: Start the application with the command line switch: -XmxSizeUnits for example: To set a max heap size of 128Mb use: java -Xmx128m To set a max heap size of 640kb use: java -Xmx640k I'm new to B4A, so I don't know yet how to change the java compiler directives from inside the IDE. Perhaps someone else can provide that info .. Cheers
stefanoa Active Member Licensed User Longtime User Jan 22, 2012 #3 thanks... but the code is correct.. i've to know how modify those parameters in B4A IDE. I have about 46 modules in my projects... if I delete some module... it works! please help thanks Upvote 0
thanks... but the code is correct.. i've to know how modify those parameters in B4A IDE. I have about 46 modules in my projects... if I delete some module... it works! please help thanks
S SiriusCG Member Licensed User Longtime User Jan 22, 2012 #4 You may need to refactor some of your code. I've had to do this many times when creating large C/C++ projects. Is there anywhere where you can refactor your code to make it more efficient? Or, you're simply running out of memory when you try to compile all the modules at the same time. Try to reduce the number of other applications you might have running when you compile to free up memory. Splitting up your code so you don't compile all the modules at the same time might be an alternative. Cheers. Upvote 0
You may need to refactor some of your code. I've had to do this many times when creating large C/C++ projects. Is there anywhere where you can refactor your code to make it more efficient? Or, you're simply running out of memory when you try to compile all the modules at the same time. Try to reduce the number of other applications you might have running when you compile to free up memory. Splitting up your code so you don't compile all the modules at the same time might be an alternative. Cheers.
stefanoa Active Member Licensed User Longtime User Jan 22, 2012 #5 all modules are of the same project and must be compiled in the same apk... the error occurs when i try to compile.. Upvote 0
all modules are of the same project and must be compiled in the same apk... the error occurs when i try to compile..
S SiriusCG Member Licensed User Longtime User Jan 22, 2012 #6 There are a few of possibilities: 1. You have code in a another module that's causing the problem. In that case, you'll need to find the offending module and possibly refactor or recode it. You mentioned the project compiles if you reduce the number of modules. You may have some offending code in one of those you removed previously and it's halting compilation. 2. Reduce the actual number of modules by relocating code. Perhaps you can reduce the number of modules by moving code around and redistributing it. 3. There may be a limit on the number of modules that can be compiled for a particular project. I don't know if this is true, just putting it out there. Cheers. Upvote 0
There are a few of possibilities: 1. You have code in a another module that's causing the problem. In that case, you'll need to find the offending module and possibly refactor or recode it. You mentioned the project compiles if you reduce the number of modules. You may have some offending code in one of those you removed previously and it's halting compilation. 2. Reduce the actual number of modules by relocating code. Perhaps you can reduce the number of modules by moving code around and redistributing it. 3. There may be a limit on the number of modules that can be compiled for a particular project. I don't know if this is true, just putting it out there. Cheers.
stefanoa Active Member Licensed User Longtime User Jan 22, 2012 #7 if i compile with "release" method, the compilation is ok but is very slow.. the error OutOfMemoryError occurs when i try to compile with "debug" method.. it's very difficult to combine different modules because they have different layouts.. Upvote 0
if i compile with "release" method, the compilation is ok but is very slow.. the error OutOfMemoryError occurs when i try to compile with "debug" method.. it's very difficult to combine different modules because they have different layouts..
S SiriusCG Member Licensed User Longtime User Jan 22, 2012 #8 I wouldn't be surprised about the memory issue when compiling with debug. It adds a lot of information to the compiled modules. It would be easy to run out of memory when compiling this way ... There's not much more I can add other than what I've already suggested. Large programs take a lot of resources. Unless you tweak the compiler memory parameters, add more physical memory perhaps to your computer or refactor your code to make it more efficient, I think you're stuck with slow compilation and no option to debug ... Cheers. Upvote 0
I wouldn't be surprised about the memory issue when compiling with debug. It adds a lot of information to the compiled modules. It would be easy to run out of memory when compiling this way ... There's not much more I can add other than what I've already suggested. Large programs take a lot of resources. Unless you tweak the compiler memory parameters, add more physical memory perhaps to your computer or refactor your code to make it more efficient, I think you're stuck with slow compilation and no option to debug ... Cheers.
stefanoa Active Member Licensed User Longtime User Jan 22, 2012 #9 i search how change the compiler memory parameters in B4A IDE thanks very much... Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 23, 2012 #10 The memory used by the "dex" tool can be configured by editing the INI file. Upvote 0
stefanoa Active Member Licensed User Longtime User Jan 23, 2012 #11 ok... for now I solved by setting the value MaxRamForDex in file b4aV0.1.ini from: MaxRamForDex=512 to: MaxRamForDex=1024 thanks !!! Upvote 0
ok... for now I solved by setting the value MaxRamForDex in file b4aV0.1.ini from: MaxRamForDex=512 to: MaxRamForDex=1024 thanks !!!
C cbal03 Active Member Licensed User Longtime User Jan 15, 2013 #12 Debug Compilation OutOfMemoryError I am also running into this problem. I have begun to use the newest version 2.5 and still I have debug mode compilation problems. I can however compile normally. Upvote 0
Debug Compilation OutOfMemoryError I am also running into this problem. I have begun to use the newest version 2.5 and still I have debug mode compilation problems. I can however compile normally.
Erel B4X founder Staff member Licensed User Longtime User Jan 15, 2013 #13 You should increase the MaxRamForDex value in the ini file. http://www.b4x.com/forum/basic4andr...imized-dex-error-need-help-pls.html#post58036 Upvote 0
You should increase the MaxRamForDex value in the ini file. http://www.b4x.com/forum/basic4andr...imized-dex-error-need-help-pls.html#post58036
C cbal03 Active Member Licensed User Longtime User Jan 15, 2013 #14 Thank you Erel. I'll do that. Great new release! The change from 512 to 1024 worked nicely. Last edited: Jan 15, 2013 Upvote 0