[Ruby] Prevent WWW::Mechanize from stealing your memory
Wednesday, September 3, 2008 12:49:48 PM
I unassigned them, let them create in forked processes, which i killed afterwards, and ran the GC manually every second.
Still my little programm wished for nothing less than to fill all available memory.
The solution to this was rather simple: WWW::Mechanize holds a history of visited pages, so one can use convenient features as the browser-like back() method.
Since i did not use this at all, i just had to assign 0 to history_size on the creation of my agent, to stop calling for swapmemory:
agent = WWW::Mechanize.new{ |agent|
agent.history.max_size=0
}
I still wonder, why anyone should want this to be unassigned and therefore an infinite history, since i do not yet know anyone who possesses infinite memory for that one.













Unregistered user # Friday, November 28, 2008 10:09:15 AM
Unregistered user # Tuesday, February 3, 2009 9:17:13 PM
Unregistered user # Saturday, October 23, 2010 4:24:23 PM
Unregistered user # Thursday, September 8, 2011 9:35:20 PM