我在 Python 中有一个带有 minidom 解析器的 MemoryError。我正在读取 8000 个小文件(大多数小于 50 Kb),并且在读取 2500 次后出现此错误......`
Traceback (most recent call last):
File "C:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydevd.py", line 1307, in <module>
debugger.run(setup['file'], None, None)
File "C:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydevd.py", line 1060, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "C:\Users\calculator_2012.py", line 81, in <module>
file_content, economicFlow, elementaryFlow = XML_reader(spoldFile)
File "C:\Users\XML_reader.py", line 10, in XML_reader
xmltree = parse(spold_filename)
File "C:\Python27\lib\xml\dom\minidom.py", line 1914, in parse
return expatbuilder.parse(file)
File "C:\Python27\lib\xml\dom\expatbuilder.py", line 924, in parse
result = builder.parseFile(fp)
File "C:\Python27\lib\xml\dom\expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
File "C:\Python27\lib\xml\dom\expatbuilder.py", line 294, in character_data_handler_cdata
_append_child(self.curNode, node)
File "C:\Python27\lib\xml\dom\minidom.py", line 274, in _append_child
def _append_child(self, node):
File "C:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydevd.py", line 942, in trace_dispatch
traceback.print_exc()
File "C:\Python27\lib\traceback.py", line 232, in print_exc
print_exception(etype, value, tb, limit, file)
MemoryError
有没有人可以建议“无内存泄漏”解析器?