-
-
Notifications
You must be signed in to change notification settings - Fork 904
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
XML SAX push parser leaks memory on JRuby, but not on MRI #998
Comments
Please use |
@yokolet I think the point made here is that a streaming parser engine is not expected to consume memory proportional to the amount of total data processed. |
@yokolet @knu is correct. I do not expect the streaming parser to use an unbound amount of memory if the SAX handler is not retaining any data. The data I am parsing is never ending, so there is no natural place for me to call |
@Burgestrand |
Hi, I'm seeing a leak very similar (jruby as well), but this time when using My graphs show the same leak. reader = Nokogiri::XML::Reader(File.open('hugefile.xml'))
reader.each { |node| node.name } This is what the eclipse memory analyzer shows: I assume this line is the responsible for the leak, but it's just a guess. |
Hay!
I’m reading streaming XML from a remote server in JRuby using the SAX push parser in Nokogiri. It starts with an opening
<events>
tag, and then follows with a lot of streaming XML<event>data</event>
coming in.The following code leaks memory in JRuby (attached visualvm heap screenshot), but not in MRI.
Me and @jnicklas tracked it down to two internal variables in
nokogiri.internals.NokogiriHandler
which have content added to them for every new element, that is never released:nokogiri/ext/java/nokogiri/internals/NokogiriHandler.java
Line 145 in 2adeeb6
nokogiri/ext/java/nokogiri/internals/NokogiriHandler.java
Line 146 in 2adeeb6
The text was updated successfully, but these errors were encountered: