Q: How do I pass command-line arguments to the Java VM? I need to increase the garbage heap size, so that my application doesn't run out memory.
A: WebObjects 4 introduces a new way to specify arguments to the Java VM. The following arguments may be specified. Those ending in "Size" or "Port" take number arguments; all others take YES or NO.
- NSJavaCheckSource (equivalent to -cs or -checksource)
- NSJavaNativeStackSize (equivalent to -ss<number>)
- NSJavaStackSize (equivalent to -oss<number>)
- NSJavaMinHeapSize (equivalent to -ms<number>)
- NSJavaMaxHeapSize (equivalent to -mx<number>)
- NSJavaVerifyMode (equivalent to -verify)
- NSJavaEnableClassGC (NO is equivalent to -noclassgc)
- NSJavaEnableVerboseGC (equivalent to -verbosegc)
- NSJavaDisableAsyncGC (equivalent to -noasyncgc)
- NSJavaVerbose (equivalent to -v or -verbose)
- NSJavaDebugging (equivalent to -debug)
- NSJavaDebugPort
There are three ways to set these arguments:
1) Use the defaults command-line tool:
defaults write myapp NSJavaMinHeapSize 33554432
2) Pass them on the command line:
MyApp.woa/MyApp -NSJavaMinHeapSize 33554432
3) Set them programatically. Refer to the documentation for
NSUserDefaults (Objective C) or
com.apple.yellow.foundation.NSUserDefaults (Java).