Hey mates,

I´m a newbie to Ruby and Rails. But I´m a programer since few years. So
my problem is, that I will try to read a lot of photos with RMagick.

require 'rubygems' # if installed via Gems
require 'RMagick'
include Magick

exit 1 if ARGV.length != 1

files = Dir.new(ARGV[0])

exit 1 unless files

files.each do |file|
  next unless  file =~ %r{\.jpg$}i

  puts ARGV[0]+file
  img = Image.read(ARGV[0]+file).first
  img_orient = img.auto_orient  # turn a copy
  img_gallery = img_orient.resize_to_fit(1024,1024) # scales a copy down
end

Don´t be scared about my code... ;-)

 Ok... normaly I think, I can read every image - given from the directoy
in ARGV[0]. In C or C++ I know, that in every cicle of the loop img,
img_orient, img_gallery will be overwritten. But after 12-15 image
(appr. 2.5 MB => 30-40 MB ) the memory-allocation is incredible high...
so why?!?

I hope, that anyone can help me.

thanks!
-- 
Posted via http://www.ruby-forum.com/.