I have almost forgotten about JVM memory limit issues until today when i encountered the same problem again, my Java apps, created using NetBeans 6.7 (Java platform 1.6.0.14 32-bit), crashed again after hitting 1.6 Gigabyte dataset. However, the situations are now different, I’ve now enjoyed the power of Windows 64-bit and unlike before, i didn’t use WEKA anymore, well *ummm* in short, after tinkering here, there and everywhere, i’ve decided to install 64-bit JVM from SUN website:
here’s the link http://download.java.net/jdk6/
Look into the Windows 64-bit platform, you’ll find out something like this:
- Windows x64 Platform
jre-6u18-ea-bin-b05-windows-amd64-18_nov_2009.exe, 14.86 MB (MD5 Checksum)
jdk-6u18-ea-bin-b05-windows-amd64-18_nov_2009.exe, 64.79 MB (MD5 Checksum)
I pick the second one, and downloaded and install it,
then i make my Netbeans read the 64-bit JRE by selecting tools >> Java Platforms
a dialog box will open, select add platform, and highlights the folder you wish to install, normally you will look it up on “Program Files” folder, and not the “Program Files (x86)” folder.
Finish and restart the NetBeans.
Now i recompiled and then re-run my Apps (console) using this command line below:
java -Xmx3000m -Xms70m -Xss1024k -jar “apps.jar” –db=”127.0.0.1/dataset”
The only thing you must be concerned of is the -Xmx, -Xms and -Xss part (bold), the -Xmx switch allow maximum heap size of 3000m (equivalent to 3 GB), if you are using device with > 3 GB physical memory, say 8 GB then go head, change it to suits your needs, however for -Xms, i prefered to set it to a much-much lower number than the previous parameters, the -Xss switch determine the stack size, i find 1MB or 1024k is acceptable for my apps. Now let’s take a look on what we achieved here…. (Click to zoom the screenshot):
As you can see my apps were able to utilize more than 3GB of my physical memory, i think this is great compared to my previous post. Okay that’s all, i hope you find it useful, although not much,…. ^_^
Leave a comment