From: Tim Hunter Date: 2009-08-28T08:28:31+09:00 Subject: Re: RMagick reacts very oddly to an incorrect file Pito Salas wrote: > I am not sure if this is me or Rmagick. I 'accidentally' used an input > file which was a 40Meg multi-image TIF with 50 or so images and my mac > os x went totally haywire. As I traced down into the problem I got to > this: > > # Initialize new instances > def initialize(*filenames, &block) > @images = [] > @scene = nil > filenames.each { |f| > Magick::Image.read(f, &block).each { |n| @images << n } > } > if length > 0 > @scene = length - 1 # last image in array > end > self > end > > Which is near line 1600 of RMagick.rb. And in particular, the line > > Magick::Image.read(f, &block).each { |n| @images << n } > > Is where things go sour. My disk whirls like crazy, my mac becomes > totally unresponsive and eventually I figured out that I could locate a > particular process running ruby and kill it surgically and after a few > moments things settled back to normal. > > Odder still, if I stepped into the Image.read I found the particular > call was to @path.dup where things went sour. @path at that moment > seemed to have an innocuous string in it. > > I assume this is sufficiently arcane that only one person on this list > will have a comment... But if anyone, especially TimH can shed some > light I would appreciate it! > > I want to put some defensive code into my stuff but I am not sure what I > am checking for. Is it just a very large file or what? > > Thanks!! > > Pito My guess is that you ran out of memory and OS X started swapping to disk. This would explain your disk whirling and your computer getting unresponsive. Killing the process freed the memory and things went back to normal. -- MagickWand for Ruby - http://magickwand.rubyforge.org/