Classpath developer guidelines


java.lang.OutOfMemoryError problem

The problem arises when the compiler itself is written in Java and runs on some virtual machine. If no extra keys are given, some virtual machines (Cacao and also many proprietary implementations) terminate after the memory use exceeds 64 Mb. Usually more memory can be used if the -Xmx switch is given. For instance, the compiler startup line in the ecj compiler startup script (/usr/bin/ecj or some similar location) frequently looks like:

With Cacao or Sun's jre this may fail but can easily fixed by adding something like -Xmx400m after "java".

Some compilers support the -J-Xmx key (-J-Xmx512M, for instance). Such keys can be added to lib/Makefile's JCOMPILER for that particular compiler. Unfortunately, ecj seems currently ignoring this option.

The problem was never observed with gcj as it is has no such memory limitations. However gcj currently cannot compile generics and, to build the CVS version, must be replaced by ecj.

How to avoid Swing programming errors

EventQueue loops

Here are some rules how to avoid this:

Chose non-conflicting field and method names

ClasspathDeveloperGuidelines (last edited 2007-05-08 18:34:57 by audriusa)