diff --git a/spark/src/main/scala/org/apache/spark/shuffle/sort/RowPartition.scala b/spark/src/main/scala/org/apache/spark/shuffle/sort/RowPartition.scala index bce24be1f6..32d64fad42 100644 --- a/spark/src/main/scala/org/apache/spark/shuffle/sort/RowPartition.scala +++ b/spark/src/main/scala/org/apache/spark/shuffle/sort/RowPartition.scala @@ -32,8 +32,17 @@ class RowPartition(initialSize: Int) { def getNumRows: Int = rowAddresses.size - def getRowAddresses: Array[Long] = rowAddresses.toArray - def getRowSizes: Array[Int] = rowSizes.toArray + def getRowAddresses: Array[Long] = { + val array = rowAddresses.toArray + rowAddresses = null + array + } + + def getRowSizes: Array[Int] = { + val array = rowSizes.toArray + rowSizes = null + array + } def reset(): Unit = { rowAddresses = new ArrayBuffer[Long](initialSize)