Monday, March 11, 2013

QT005: Allocating More Memory for Cast Iron Studio

Quick Tip #005:  Allocating More Memory for Cast Iron Studio

By default, the maximum amount of memory available in Cast Iron Studio is 512MB.  Most of the time, that is more than adequate.   However, if you find yourself working with a large XML Schema in a map or testing a complicated XSLT, or for many other reasons you may need additional memory.

Background

Cast Iron Studio is Java application and like all Java applications, the amount of memory available is bounded by the Java Virtual Machine (JVM).  There are several JVM parameters related to memory that can be set at JVM startup time, typically the most important parameters are those related to the JVM heap.  The JVM is the long term / global memory used by the application and there are two parameters that are important here, the minimum and maximum size of the heap.  The minimum or initial size is the memory that is allocated when the JVM starts and the maximum size is the upper bound of the heap.  If an application tries to allocate more memory than the maximum heap size a java.lang.OutOfMemoryError is thrown.  For our purposes the minimum heap size can be left alone, the heap will grow automatically until the maximum is reached and the default value is typically fine for use with Studio.

How do I set the Maximum Heap Size for Cast Iron Studio?

First located the CastIronStudio.exe executable, it should be in the main folder where you installed studio.  Right click the executable and select create shortcut:



This will create a new file called Shortcut to CastIronStudio.exe, you will now need to edit the shortcut and specify the JVM Parameter to increase the heap size: [-J-XmxSSSSm].  Where SSSS is the new heap size in megabytes i.e. -J-Xmx1024m.  See the screenshot below:



Next you will probably want to switch to the General Tab and change the name to something more meaningful and indicative of the parameter that you set Such as "Cast Iron Studio 6.3.0.1 - 1024m" that way you will be able to distinguish the modified version from the original and will know whether or not you are using the larger heap size.

That's it, just double click the shortcut to run studio with a larger heap size.  Note: we demonstrated this setting with the latest version 6.3.0.1 on Windows XP, however, the process is the same for any install4j based version of Studio.  Also, the process on other versions of Windows such as Windows Server or Windows 7 is almost identical (the only change on Windows 7 is the name windows generates for the shortcut).

No comments:

Post a Comment