Skip to content

OutOfMemoryException because of very big Generic instance #786

@knsa83

Description

@knsa83

Hello,
I have the problem that our VM crashes with an OutOfMemoryException, because of very big Generic instance (approximately 2 GB).

This instance contains a very large Array of GenericTypes (268.435.455 items). All of the Array values contain the same Type or null.

Additionally we observe that we get following exception before the OOM-Exception happens (not always):

WARNING: java.lang.ArrayIndexOutOfBoundsException: Index 134217728 out of bounds for length 134217728
at com.esotericsoftware.kryo.util.DefaultGenerics.popGenericType(DefaultGenerics.java:66)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.write(CollectionSerializer.java:163)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.write(CollectionSerializer.java:44)
at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:644)
...

I think the problem started as I switch from 5.0.0.RC1 to 5.0.0-Release.

Currently kryo.setOptimizedGenerics(optimizedGenerics); is not stated explicity. Maybe the problem won't occur if this is set to false. I will look into this.

Greetings Sandra

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions