Reputation: 187
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!
Upvotes: 5
Views: 18501
Reputation: 151
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 flagUseCompressedClassPointers
(on by default). If theUseCompressedClassPointers
is used, the amount of space available for class metadata is fixed at the amountCompressedClassSpaceSize
. If the space needed forUseCompressedClassPointers
exceedsCompressedClassSpaceSize
, ajava.lang.OutOfMemoryError
with detail Compressed class space is thrown.Action: Increase
CompressedClassSpaceSize
or you can turn offUseCompressedClassPointers
. Note: There are bounds on the acceptable size ofCompressedClassSpaceSize
. 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.
Upvotes: 6
Reputation: 106
Compressed Class space is part of the metaspace.
Looks like your resolution is to either increase max metaspace size, or you may potentially have a leaky classloader.
Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. In this case, The garbage collector cannot make space available to accommodate a new object, and the heap cannot be expanded further. Also, this error may be thrown when there is insufficient native memory to support the loading of a Java class. In a rare instance, a java.lang.OutOfMemoryError may be thrown when an excessive amount of time is being spent doing garbage collection and little memory is being freed.
Upvotes: 4