from lxml import etree
context = etree.iterparse(xmlfile)
for event, elem in context:
    elem.clear()
while elem.getprevious() is not None:
    del elem.getparent()[0]
Обработка XML по частям в Python