From: ruby rails Date: 2008-03-21T14:43:17+09:00 Subject: Re: newbie question regarding memory leak Atlast I figured it out. Rather than declaring @agent as an instance variable, i tried declaring it as a local variable and that does the trick. Previously it used to eat up 400-500 MB of memory but now, it uses a max of 15 MB. I modified my code from def initialize @agent = WWW::Mechanize.new end def fetch_links(start, finish, count) page = WWW::Mechanize::Page ........ ........ end to look like below def initialize end def fetch_links(start, finish, count) agent = WWW::Mechanize.new page = WWW::Mechanize::Page end Any interpretations from this? -- Posted via http://www.ruby-forum.com/.