A WebObjects application may stop responding ("crash" or "hang") with a "java.lang.OutOfMemoryError" exception if the application is particularly large, maintaining a large number of active sessions, or caching too many database objects.
Solution
Assuming the memory usage of the application cannot be reduced (by limiting the number of active sessions, limiting database fetches, and so forth), the exception can be prevented by allowing the Java VM to use more RAM. Unlike other application processes, Java applications are launched with an option specifying the maximum allowed RAM usage. The default maximum is 64 MB.
Use the Java command-line option -Xmx to change the maximum RAM usage. There are three places where this can be set:
Method 1: Use Project Builder.
This method only affects applications launched from within Project Builder.
2. Under Launch Arguments, click the "+" icon to add an argument.
3. Enter: -Xmx128m
This method affects applications launched from within Project Builder, applications launched from the command-line, and applications launched from Monitor.
2. Under Settings, select Expert View.
3. Set JVM_OPTIONS to -Xmx128m
4. Save and rebuild the project.
This method only affects applications launched from Monitor.
2. Click the Config icon next to the application.
3. Under Additional Arguments, enter -Xmx128m
4. Click Push All.
The option -Xmx128m sets the maximum RAM usage to 128 MB, but is only an example. Experiment with different values to find what gives the best performance. Setting the value too high may cause temporary slowdowns during garbage collection or disk paging. Some applications may benefit from setting the minimum RAM usage equal to the maximum. You can do this by setting the Java VM options to -Xms128m -Xmx128m.
These techniques may be used to set certain other Java VM options as well. Any option beginning with -X or -D may be specified. For more information on available arguments, see the Java runtime documentation (http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/java.html#options).