Java Virtual Machine
The Java virtual machine (JVM) is the platform dependent interpreter of the Java bytecode (i.e.…
The Java virtual machine (JVM) is the platform dependent interpreter of the Java bytecode (i.e., the classes). It translates the bytecode into machine specific instructions.
If you start
and heap. The stack size does not pose a problem in most cases, but the heap size does, since it limits the amount of memory a Java program can use for its data structures. In Java 1.4, the default was 64MB, which is quite often not enough for programs, especially in Machine Learning. In case
run into an OutOfMemory Exception, try to
64-Bit sections.) With the Sun JVM, you can do this via the -Xmx option. For example, setting the maximum size to 512MB is done like this (note: this will NOT work from inside the SimpleCLI):
java -Xmx512m ...
Note that there is no suffix "g" for "gigabyte", so figures must be specified in megabytes. Hence, 2GB would be specified as "-Xmx2048m".
Notes on Windows (RunWeka.bat, RunWeka.ini):
The heap size can be changed by editing one of the files RunWeka.bat or RunWeka.ini, located in the Weka directory (e.g., C:\Program Files\Weka-3-4 for version 3.4.x), or by modifying the shortcut parameters. The following will describe which change to make, based on Weka version.
<= 3.5.2/<= 3.4.7
Weka comes with two shortcuts in the Windows Start Menu. Only the one with (console) in its name executes the RunWeka.bat batch file. If you use this shortcut to start Weka, increase the heap size in the batch file. The other shortcut starts Weka directly, avoiding the command prompt. If you use this shortcut, you must edit the parameters specified in the "Target" field for the shortcut in order to increase the memory.
>= 3.5.4/>= 3.4.9
Modify the maxheap parameter in the RunWeka.ini file.
The JVM specifications can be found at Sun's homepage:
Class File Format
A detailed overview of the format of class files can be found here.
The major version is located at bytes 7 and 8, the minor version at 5 and 6.
Here's an overview of some Java versions and their major version bytes:
1.1: 00 2D (= 45)
1.2: 00 2E (= 46)
1.3: 00 2F (= 47)
1.4: 00 30 (= 48)
1.5: 00 31 (= 49)
1.6: 00 32 (= 50)
1.7: 00 33 (= 51)
BTW the first 4 bytes of a Java class spell cafe babe in hex notation! ;-)
With a 32-Bit machine you can address at most 4GB of virtual memory. Different operating systems divide up the memory further into system/kernel and user space. The following splits are commonly used (kernel/user):
50/50: Windows, Linux, Mac
From experience, you can achieve the following maximum sizes for the heap:
with loading the DLL Xpsp2res.dll
You can obtain very large VM object heaps on Windows platforms by using BEA JRockit runtime which does not require a contiguous memory space...
To unleash the power of your 64-Bit machine, you need a JVM designed for 64-Bit. Sun and Oracle/BEA offer JVMs for 64-Bit architectures:
Java 1.5.x (branded as Java 5)
Java 1.6.x (branded as Java 6)
Java programming language
Java virtual machine