Sunday, July 13, 2008

Xtext and Java VM configuration

By developing DSLs with Xtext one usually work with two Eclipse workbenches:
  • one by design-time containing three projects: the grammar, the DSL-editor and the generator,
  • and a second one started from the first where the three DSL-plugin are deployed.
In order to avoid PermGem space problem it is important to configure properly the VM where the second runtime-workbench is started. A good setting is:


-Xms256m -Xmx512m -XX:MaxPermSize=256m

If you are working on Max OS you will possibly get the following errors : "Cannot load 32-bit SWT libraries on 64-bit JVM". To fix the problem I use the following VM parameters:

-d32 -Dosgi.requiredJavaVersion=1.5 -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -XX:MaxPermSize=256m -Xms256m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts