Android Question Cannot increase MaxRamForDex

Status
Not open for further replies.

yo3ggx

Active Member
Licensed User
Longtime User
Hi,

I'm running B4A (latest version 8.30) on a Windows 10 Pro computer with an i5 processor and 24GB or RAM. The "Convert byte code - optimized dex." takes 18.14s. I want to speed up the process and tried to increase MaxRamForDex from 1024 to 2048. Unfortunately for any value over 1024 I get the following error:

Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

There is something else I can try?

Thank you.
Dan
 

Attachments

  • dex.jpg
    dex.jpg
    47.8 KB · Views: 615

DonManfred

Expert
Licensed User
Longtime User
Could not reserve enough space for 2097152KB object heap
looks like there is not enough free ram on your pc...

Don´t know if it is important: Are you using a 32 or 64 bit java (configured in the IDE)?

I have set 4096 there and it works without a problem here. I´m using 64bit java.
 
Upvote 0

yo3ggx

Active Member
Licensed User
Longtime User
My system has more than 16GB of free RAM (from the existing 24GB), so for sure this is not an issue.
I'm using 16 bit java, I was not aware that B4A already supports 64-bit Java.
I've tried again with 64-bit Java and the result is the same:

Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
You should manually increase/set your Java Options settings in Windows Environment Variables to -Xmx512m -Xms512m which is what mine is set to. You can actually set it to anything you like for example -Xmx1024m -Xms1024m etc, this might fix your issues.
 
Upvote 0

yo3ggx

Active Member
Licensed User
Longtime User
This is what I have now:

C:\>java -XX:+PrintFlagsFinal -version | find "HeapSize"
uintx ErgoHeapSizeLimit = 0 {product}
uintx HeapSizePerGCThread = 87241520 {product}
uintx InitialHeapSize := 402653184 {product}
uintx LargePageHeapSizeThreshold = 134217728 {product}
uintx MaxHeapSize := 2132803584 {product}
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

but still I cannot set the parameter higher than 1024 (64 bit Java).
 
Upvote 0

yo3ggx

Active Member
Licensed User
Longtime User
Looking again in the Config Paths I've seen that it was reverted back to 32bit Java, even if previously saved with 64bit java.
Tried again and now I'm able to use even MaxRamForDex=8192 , but unfortunately Convert byte code still takes ~18s same as with x86 java and MaxRamForDex=1024.

I don't know what else to try to speed up the process...
 
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
You should manually increase/set your Java Options settings in Windows Environment Variables to -Xmx512m -Xms512m which is what mine is set to. You can actually set it to anything you like for example -Xmx1024m -Xms1024m etc, this might fix your issues.
What's the exact variable name?
 
Upvote 0
Status
Not open for further replies.
Top