self.dom = dom = minidom.parse(datasource)
datasource
is a 30MB XML file. This parse statement constructs a tree structure and it consumes almost 2.5GB of RAM which is too for me.
However, my company currently uses only python 2.4 so cant use ElementTree or any latest parsing methods. Switching to SAX parsing also is very costly for me now. So, is there any optimizations with DOM parsing that I can do so that the amount of memory used is reduced?
Also, I wish to know if the parsing of the XML file takes 2.5G or if the tree structure(dom/self.dom) thus generated after parsing takes so much memory? How do I find that?