File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
core/src/main/scala/org/apache/spark/serializer Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -26,14 +26,16 @@ import org.apache.spark.SparkConf
2626private [spark] class JavaSerializationStream (out : OutputStream ) extends SerializationStream {
2727 val objOut = new ObjectOutputStream (out)
2828 var counter = 0
29+ val counterReset = System .getProperty(" spark.serializer.objectStreamReset" , " 10000" ).toLong
30+
2931 /* Calling reset to avoid memory leak:
3032 * http://stackoverflow.com/questions/1281549/memory-leak-traps-in-the-java-standard-api
3133 * But only call it every 1000th time to avoid bloated serialization streams (when
3234 * the stream 'resets' object class descriptions have to be re-written)
3335 */
3436 def writeObject [T ](t : T ): SerializationStream = {
3537 objOut.writeObject(t)
36- if (counter >= 1000 ) {
38+ if (counterReset > 0 && counter >= counterReset ) {
3739 objOut.reset()
3840 counter = 0
3941 } else {
You can’t perform that action at this time.
0 commit comments