Skip to content

Commit

Permalink
disable gc while unpickle
Browse files Browse the repository at this point in the history
  • Loading branch information
Davies Liu committed Nov 22, 2014
1 parent e5ee6b9 commit b98de1d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/pyspark/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import os
import cPickle
import gc
from tempfile import NamedTemporaryFile


Expand Down Expand Up @@ -87,7 +88,11 @@ def load(self, path):
flag = f.read(1)
data = f.read()
if flag == 'P':
return cPickle.loads(data)
gc.disable()
try:
return cPickle.loads(data)
finally:
gc.enable()
else:
return data.decode('utf8') if flag == 'U' else data

Expand Down

0 comments on commit b98de1d

Please sign in to comment.