OutOfMemoryError: Compressed class space

user3167150 picture user3167150 · Feb 2, 2016 · Viewed 13.8k times · Source

I got this error:

 "java.lang.OutOfMemoryError: Compressed class space"

and until I'll figure out what's the trigger, I tried to disabling compressed class pointers with

-XX:-UseCompressedClassPointers.

but I still get this error. how is it possible?

Thanks!

Answer

alban picture alban · Jan 9, 2017

This exception is explained in Understand the OutOfMemoryError Exception:

Cause: On 64-bit platforms a pointer to class metadata can be represented by a 32-bit offset (with UseCompressedOops). This is controlled by the command line flag UseCompressedClassPointers (on by default). If the UseCompressedClassPointers is used, the amount of space available for class metadata is fixed at the amount CompressedClassSpaceSize. If the space needed for UseCompressedClassPointers exceeds CompressedClassSpaceSize, a java.lang.OutOfMemoryError with detail Compressed class space is thrown.

Action: Increase CompressedClassSpaceSize or you can turn off UseCompressedClassPointers. Note: There are bounds on the acceptable size of CompressedClassSpaceSize. For example -XX:CompressedClassSpaceSize=4g, exceeds acceptable bounds will result in a message such as CompressedClassSpaceSize of 4294967296 is invalid; must be between 1048576 and 3221225472.