I have a XML file, which is about 30MB, there are about 300000 element in it.
I use the following code to process this file.
xmldoc=xml.dom.minidom.parse("badges.xml") csv_out=open("badge.csv","w") for badge in xmldoc.getElementsByTagName("row"): some processing here csv_out.write(line)
The file is only 30MB, but when I run this script on my MBP (10.7, 8G RAM), it uses nearly 3GB memory. Why such simple script and such small file use so much memory?