Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When running Java-based jobs (or other multi-threaded jobs) on YARCCthe physnodes, you may encounter problems with memory allocation - the JVM fails to start up, reporting a lack of memory. This is not related to the actual memory usage of your program, but to the way in which memory allocation is handled by the Sun Grid Engine. The problem can be solved by suitable configuration options.

Memory allocation in Java

The Java Virtual Machine (JVM) and the underlying C library, glibc, allocate a potentially large amount of virtual memory on startup. Note that this is virtual memory (allocated address space) and not resident memory (actual usage of RAM). On 64-bit machines, virtual memory is normally a very cheap resource. However, YARCC the physnodes restricts jobs in their use of virtual memory, not resident memory; hence virtual memory allocation needs to be controlled.

...

  • Setting the environment variable MALLOC_ARENA_MAX=4. This affects glibc and will limit the number of "arenas" allocated.
  • Limiting the number of GC threads, using the "-XX:ParallelGCThreads=..." startup parameter.

An example job descriptor file

The following job decriptor file would be suitable for a non-memory intensive, non-threaded Java job (max.100 MByte heap space).

Code Block
languagebash
titleMemory configuration for Java jobs
#$ -cwd
#$ -V
#$ -l h_vmem=2G
#$ -l h_rt=00:10:00
export MALLOC_ARENA_MAX=4
vmArgs="-Xmx100m -XX:ParallelGCThreads=1"
java $vmArgs NameOfYourProgram

More information

...