Skip to content

Commit 0732445

Browse files
committed
support setting maxCapacity to something different than capacity in kryo Output
1 parent 7c18428 commit 0732445

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/main/scala/org/apache/spark/serializer/KryoSerializer.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ class KryoSerializer(conf: SparkConf)
3939
with Logging
4040
with Serializable {
4141

42-
private val bufferSize = conf.getInt("spark.kryoserializer.buffer.mb", 2) * 1024 * 1024
42+
private val bufferSizeMb = conf.getInt("spark.kryoserializer.buffer.mb", 2)
43+
private val maxBufferSizeMb = conf.getInt("spark.kryoserializer.buffer.max.mb", bufferSizeMb)
4344
private val referenceTracking = conf.getBoolean("spark.kryo.referenceTracking", true)
4445
private val registrator = conf.getOption("spark.kryo.registrator")
4546

46-
def newKryoOutput() = new KryoOutput(bufferSize)
47+
def newKryoOutput() = new KryoOutput(bufferSizeMb * 1024 * 1024, maxBufferSizeMb * 1024 * 1024)
4748

4849
def newKryo(): Kryo = {
4950
val instantiator = new EmptyScalaKryoInstantiator

0 commit comments

Comments
 (0)