Sun Java System Application Server 9.1 Performance Tuning Guide

Guidelines for Java Heap Sizing

Maximum heap size depends on maximum address space per process. The following table shows the maximum per-process address values for various platforms:

Table 4–1 Maximum Address Space Per Process

Operating System  

Maximum Address Space Per Process  

Redhat Linux 32 bit 

2 GB 

Redhat Linux 64 bit 

3 GB 

Windows 98/2000/NT/Me/XP 

2 GB 

Solaris x86 (32 bit) 

4 GB 

Solaris 32 bit 

4 GB 

Solaris 64 bit 


Maximum heap space is always smaller than maximum address space per process, because the process also needs space for stack, libraries, and so on. To determine the maximum heap space that can be allocated, use a profiling tool to examine the way memory is used. Gauge the maximum stack space the process uses and the amount of memory taken up libraries and other memory structures. The difference between the maximum address space and the total of those values is the amount of memory that can be allocated to the heap.

You can improve performance by increasing your heap size or using a different garbage collector. In general, for long-running server applications, use the J2SE throughput collector on machines with multiple processors (-XX:+AggressiveHeap) and as large a heap as you can fit in the free memory of your machine.