Changed parser from DOM to SAX. Now it doesn't seem to give out of memory errors, but still takes waaay to long to reload file.