A Voyager deployment contains a mid-tier server called the Multi-Dimensional Analysis Services (MDAS) server. This server is a Java process but also contains a significant C++ part. The fact that the server is a hybrid of Java and C++ has some important consequences for the way memory is used and most importantly has an impact on how much memory should be given to the Java heap. Here are the important concepts to understand. h6. A 32 bit process has 2 GB available A single instance of an MDAS server is a single process. Any single process has access to a maximum of 2 GB of memory. This means that a single MDAS server can consume up to 2 GB of memory before running out. This is regardless of how much memory is available on a particular machine. For example a high specification server may have 32 GB of ram installed on it, but a single process can only consume 2 GB at any one time. Having 32 GB of ram would just mean that it is possible to have a larger number of processes running at the same time. h6. What memory does Java use The Java heap is the name of the area of memory that Java uses to allocate new objects. There are two JVM arguments which govern the maximum and minimum sizes for the Java heap. The argument -Xms defines the minimum heap size. The argument -Xmx defines the maximum heap size. If the heap is at its maximum size and any there are attempts to allocate more memory then out of memory errors will occur. h6. The MDAS server will allocate memory through both its Java and C++ components The 2 GB of memory potentially available to the MDAS server will need to be shared by both the Java and C++ part of the MDAS server. h6. Java objects often have associated C++ objects The way the MDAS server is architected means that when objects are created in the Java layer, they often in turn create and own objects in the C++ layer. The important implication of this is that the Java garbage collector is indirectly responsible for cleaning up memory on the C++ side. So a C++ object which is owned by a Java object won’t free its memory until the Java garbage collector destroys the owning Java object. h6. The Java garbage collector does not know about memory allocated by the C++ component When the Java garbage collector is calculating how much memory it has available it does not take into account memory allocated for C++ objects. It is only looking at memory available in the Java heap. So, if for example, the garbage collector thinks it has got 1 GB of memory available. However the C++ component has already taken up 1.5 GB of the process memory. As the Java memory approaches a level of 0.5 GB the garbage collector may not feel it needs to clean up old objects as it still thinks it has another 0.5 GB to use up. However as the Java memory usages gets over 0.5 GB there will be no memory left for the process as the remaining 1.5 GB of the available 2 GB is taken up by the C++ memory. h6. More memory is generally consumed on the C++ side than the Java side Although there isn’t a simple formula to compute how much memory will be allocated on the C++ side given a specific memory load on the Java side it is safe to say that more memory is consumed by the C++ side than the Java side. The exact ratio will depend on the precise workflows that the MDAS server is handling and will vary between workflows, but experiments have shown the C++ side allocating up to two and a half times as much memory as the Java side. h6. What should the Java heap size be set to? The ‘out of the box’ setting for XI 3.1 is 256 MB. This setting is a good default setting and is usually sufficient for workflows with average data and memory loads. If the usage of Voyager is expected to involve the exporting of large amounts of data then the setting may be too restrictive. However it is not advisable to go above 512 MB. As mentioned above the memory is allocated between the Java and C++ sides with a ratio of 1 to 2.5 so using this as a ration to roughly apportion the 2GB available to the process this will mean 2 GB / ( 1 + 2.5 ) = 585 MB (1 GB = 1024 MB). h6. Adjusting the heap size The Java heap size of an MDAS server can be altered by changing the value of the -Xmx command line parameter for the MDAS server. The command line parameters can be accessed by viewing the server’s properties in the Central Management Console (CMC). For example, once the server’s page is up, right click on the instance of the MDAS server to be changed and select the properties option as indicated in the following screen shot.The screen shot below shows the area to edit the command line parameters.