First, you need a 64-bit OS and a 64-bit JVM (well, if you are running 32-bit Linux you might be able to get a 2GB heap). Second, you an't tell the JVM to not do any garbage collections until it reached 1.5GB of usage. Finally, are you sure that you really need a 2GB heap?
To get a better understanding of how GC works, see my whitepapers titled:
- Java Garbage Collection Statistical Analysis 101
- Java Garbage Collection Performance Analysis 201
at http://www.cmg.org/cgi-bin/search.cgi?q=java+peter+johnson&x=30&y=10
In the JBoss AS run config file, change the JAVA_OPTS line that sets the heap. Example:
set "JAVA_OPTS=-Xms2048m -Xmx2024m -XX:MaxPermSize=256M"
I would provide some more specific instructions but you never said:
- what OS you are running on
- which version of JBoss AS you are using
- which version of the JVM you are running