##// END OF EJS Templates
reduce memory used when appendfile appends to real file.
Vadim Gelfer -
r2236:d7f86678 default
parent child Browse files
Show More
@@ -130,14 +130,14 class appendopener(object):
130 tmpnames = self.tmpnames.items()
130 tmpnames = self.tmpnames.items()
131 tmpnames.sort()
131 tmpnames.sort()
132 for name, tmpname in tmpnames:
132 for name, tmpname in tmpnames:
133 fp = open(tmpname, 'rb')
133 ifp = open(tmpname, 'rb')
134 s = fp.read()
134 ofp = self.realopener(name, 'a')
135 fp.close()
135 for chunk in util.filechunkiter(ifp):
136 ofp.write(chunk)
137 ifp.close()
136 os.unlink(tmpname)
138 os.unlink(tmpname)
137 del self.tmpnames[name]
139 del self.tmpnames[name]
138 fp = self.realopener(name, 'a')
140 ofp.close()
139 fp.write(s)
140 fp.close()
141
141
142 def cleanup(self):
142 def cleanup(self):
143 '''delete temp files (this discards unwritten data!)'''
143 '''delete temp files (this discards unwritten data!)'''
General Comments 0
You need to be logged in to leave comments. Login now