Re: Expat loading the entire file in memory?
Karl Waclawek <[email protected]> Mon, 4 Apr 2011 08:53:00 -0400
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
XML_MIN_SIZE only affects the size of the library. It is not meant for decreasing memory usage. Also, Expat should not use 500MB on a 1GB file, unless that file contains a 500MB long element name or such things. Maybe you should post your code. On Mon, Apr 4, 2011 at 5:27 AM, Guillaume Drevon < [email protected]> wrote: > I have been able to solve my issue. In fact there is a macro that you need > to define before building expat lib: XML_MIN_SIZE > > With this, expat will keep the memory usage very low. In my case, it was > below 3MB, which is much much less than 500MB! > > Expat documentation warns that this option will make expat running slower > so this is why it is not the default behavior. This makes sense as it will > work well except for extreme files like mine. > > Note that expat was not loading the entire file in memory, as else it would > have needed 1GB due to the unicode conversion. > > > > > > On Wed, Mar 30, 2011 at 12:08 PM, Guillaume Drevon > > <[email protected]> wrote: > > > I am trying to use Expat for parsing a 500MB file. I read the file by > chunks (of 1000 byte) and send them to the parser. However, the memory used > by my application goes up to 550 MB. > > > The memory usage is entirely done by expat as the XmlParserFree does > remove almost all memory consumption. I see that the memory is mostly used > by the m_buffer member of the parser. > > > > > > Am I doing something wrong? The purpose of this SAX-like parser is not > memory usage? > > _______________________________________________ > Expat-discuss mailing list > [email protected] > http://mail.libexpat.org/mailman/listinfo/expat-discuss >