Skip to content

Loading…

Memory leak - Nokogiri::HTML #708

Closed
rcarvalho opened this Issue · 2 comments

3 participants

@rcarvalho

I was trying to narrow down memory issues in my application and I have narrowed it down to this call. Now, if I create a test app that just calls this in a loop with some data, the memory will keep growing and growing in activity monitor. Here is my code below. Also, just FYI... it is not httparty as I tried to put that in a loop by itself and it did not grow.

require 'httparty'
require 'nokogiri'

class Test
    def self.run
        idx = 0
        while true
            doc = Nokogiri::HTML(HTTParty.get("http://yahoo.com").body)
            puts "run loop: #{idx}"
            idx += 1
        end
    end
end
@tenderlove
Sparkle Motion member

Two things:

  1. Can you paste the output of nokogiri -v
  2. Can you eliminate httparty by downloading the html body and writing to a file, and make sure memory still grows?
@rcarvalho

Crap, I'm sorry Aaron. I tested it again with just a string and it's not getting bigger. It looks like it's HTTParty that's growing over time. There were so many variables that I tested and I think I just got confused. Thanks for the quick response, though. Hey, I know this probably isn't the forum for this, but while we're speaking, I know you were working on integrating a javascript engine into mechanize. Any word on that?

@jvshahid jvshahid closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.