Memory leak - Nokogiri::HTML #708

Closed
rcarvalho opened this Issue Jun 20, 2012 · 2 comments

Comments

Projects
None yet
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

This comment has been minimized.

Show comment
Hide comment
@tenderlove

tenderlove Jun 20, 2012

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?
Member

tenderlove commented Jun 20, 2012

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

This comment has been minimized.

Show comment
Hide comment
@rcarvalho

rcarvalho Jun 20, 2012

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?

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 Nov 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment