I am using Rails 3.1.1 and deploying on Heroku. I am using open-uri and Nokogiri.
I am trying to troubleshoot a memory leak (?) that occurs while I am trying to fetch and parse an xml-file. The XML feed I am fetching and trying to parse is 32 Mb.
I am using the following code for it:
require 'open-uri'
open_uri_fetched = open(feed.fetch_url)
xml_list = Nokogiri::HTML(open_uri_fetched)
where feed.fetch_url is an external xml-file.
It seems that while parsing the xml_list with Nokogiri (the last line in my code) the memory usage explodes up to 540 Mb usage and continues to increase. That doesn't seem logical since the XML-file is only 32 Mb.
I have looked all over for ways to analyze this better (e.g. ruby/ruby on rails memory leak detection) but I can't understand how to use any of them. MemoryLogic seems simple enough but the installation instructions seem to lack some info...
So, please help me to either determine whether the code above should use that much memory or (super simple) instructions on how to find the memory leak.
Thanks in advance!