java.lang.OutOfMemoryError (Terrain)

Hi…

After finally getting a walkaround camera to work with the Terrain demo, I decided to add an MD3 model to my world.

Unfortunately I keep getting the following runtime error:
Exception in thread “main” java.lang.OutOfMemoryError

If I set the maxLevel to anything below 12
i.e. terrain = new Terrain(11,10);
the model gets loaded up without any problems, but then my worldsize is greatly reduced…

Is there anything that I can do to allow my world size to stay the same (8192 units) and my model to be loaded without the aboce exception?

Cheers

increase your heap size


[divzero@localhost xith3d]$ java -X -?
    -Xmixed           mixed mode execution (default)
    -Xint             interpreted mode execution only
    -Xbootclasspath:<directories and zip/jar files separated by :>
                      set search path for bootstrap classes and resources
    -Xbootclasspath/a:<directories and zip/jar files separated by :>
                      append to end of bootstrap class path
    -Xbootclasspath/p:<directories and zip/jar files separated by :>
                      prepend in front of bootstrap class path
    -Xnoclassgc       disable class garbage collection
    -Xincgc           enable incremental garbage collection
    -Xloggc:<file>    log GC status to a file with time stamps
    -Xbatch           disable background compilation
    -Xms<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
    -Xss<size>        set java thread stack size
    -Xprof            output cpu profiling data
    -Xrunhprof[:help]|[:<option>=<value>, ...]
                      perform JVMPI heap, cpu, or monitor profiling
    -Xdebug           enable remote debugging
    -Xfuture          enable strictest checks, anticipating future default
    -Xrs              reduce use of OS signals by Java/VM (see documentation)
    -Xcheck:jni       perform additional checks for JNI functions
 
The -X options are non-standard and subject to change without notice.

naimly :
-Xms set initial Java heap size
-Xmx set maximum Java heap size

eg. java -Xms256M -Xmx512M

The bigger the initial heap size - the less agressive (read less pauses) the GC will have to be as it has heaps of room to move (no pun intended). The larger the heap size - the longer it will take to get the error you are getting.

Will.

Wicked! It worked like a charm :smiley:

Cheers William

no probs :slight_smile:

There are plenty of other useful -X options which are worth worth learning about too - for example the GC log one.

Will.