Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High memory usage on lazy parsing #10

Open
vlatkoB opened this issue Sep 7, 2018 · 0 comments
Open

High memory usage on lazy parsing #10

vlatkoB opened this issue Sep 7, 2018 · 0 comments

Comments

@vlatkoB
Copy link

vlatkoB commented Sep 7, 2018

I'm testing hexpat on a larger XML file (140MB), with a relatively simple structure:

<tmx version="1.4b">
  <header ...> </header>
  <body>
    <tu tuid="1">
      <tuv xml:lang="en-US">  <seg>Some text</seg> </tuv>
      <tuv xml:lang="hr-HR">  <seg>Other text</seg> </tuv>
    </tuv>
     ... 350,000 <tu> tags

with this code (error is not touched, as specified in the main example for lazy parsing)

withHexpat fIn fOut  = do
  inputText <- L.readFile fIn
  let (xml, _) = parse defaultParseOptions inputText :: (UNode String,Maybe XMLParseError)
  outputFile xml
  where
    outputFile xml = do
      h <- IO.openBinaryFile fOut IO.WriteMode
      L.hPutStr h $ format xml
      IO.hClose h

it very soon takes over 10GBs of memory, when I have to kill it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant