Skip to content


KryoSerializer is a Serializer that uses the Kryo serialization library.

Creating Instance

KryoSerializer takes the following to be created:

KryoSerializer is created when:

useUnsafe Flag

KryoSerializer uses the spark.kryo.unsafe configuration property for useUnsafe flag (initialized when KryoSerializer is created).

useUnsafe is used when KryoSerializer is requested to create the following:

Creating New SerializerInstance

newInstance(): SerializerInstance

newInstance is part of the Serializer abstraction.

newInstance creates a KryoSerializerInstance with this KryoSerializer (and the useUnsafe and usePool flags).


newKryoOutput(): KryoOutput


newKryoOutput is used when:

  • KryoSerializerInstance is requested for the output


newKryo(): Kryo


newKryo is used when:


factory: KryoFactory

KryoSerializer creates a KryoFactory lazily (on demand and once only) for internalPool.


KryoSerializer creates a custom KryoPool lazily (on demand and once only).

KryoPool is used when:


supportsRelocationOfSerializedObjects: Boolean

supportsRelocationOfSerializedObjects is part of the Serializer abstraction.

supportsRelocationOfSerializedObjects creates a new SerializerInstance (that is assumed to be a KryoSerializerInstance) and requests it to get the value of the autoReset field.

Last update: 2021-07-22
Back to top