The problem is not with ElementTree, but can be traced to a specific
regular expression:
_escape = re.compile(u'[&<>"\x80-\uffff]+')
I suspect it's a bug/misplaced optimization in the re module,
but haven't investigated any further than that. The specific problem
with the regular expression in the \x80-\uffff range. Changing that to
'\ufffa-\uffff' gets rid of the astronomical memory usage. I'm going to
keep looking into this as it's a particularly vexing bug ;-P
I've updated the bugzilla bug to reflect these changes.