Minidom on Python: memory issue



I'm using minidom on Python to parse an xml file. I understand that it's a somewhat slow process and takes up a substantial amount of memory. I'm using a for-next loop. The files happen to be large, but I'm fine with the time it takes to parse the first one. The first one takes a couple of minutes but when looping back and running the same parse function, it took 30 minutes to do so. Must be a memory issue. Is there anything I could do to dump the memory so that those subsequent files don't take much longer?


Example in Python (excluding the other things I do with the variable xmldoc once it's parsed):



for filename in filelist:
file = open(filename,'r')
xmldoc = minidom.parse(file)

No comments:

Post a Comment