ImageMagick for Ruby programmers: RMagick vs. MiniMagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
pitosalas

ImageMagick for Ruby programmers: RMagick vs. MiniMagick

Post by pitosalas »

This might be of interest to folks on this board:

http://www.salas.com/2009/06/19/geeky-r ... ory-leaks/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ImageMagick for Ruby programmers: RMagick vs. MiniMagick

Post by magick »

The development version of RMagick includes an enhancement to use the Ruby garbage collector. You will need to contact the author of RMagick to determine its release date.
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: ImageMagick for Ruby programmers: RMagick vs. MiniMagick

Post by rmagick »

RMagick 2.10.0 can use the Ruby garbage collector. You must build it with ImageMagick 6.5.3-10. See my post on the RMagick Hints and Tips Forum on RubyForge: http://rubyforge.org/forum/forum.php?th ... um_id=1618.
pitosalas

Re: ImageMagick for Ruby programmers: RMagick vs. MiniMagick

Post by pitosalas »

What does 'using Ruby memory management mean?" I assume(d) that RMagick would place a pointer to the ImageMagick object in a Ruby object. Even if RMagick now causes the ImageMagick object to be released once the corresponding RMagick Image object is garbage collected, this may not be enough. Because the RMagick object will be so much smaller (given that the actual image data is stored in malloc-land out of the view of Ruby, the GC would not be triggered until long after tons of memory has been tied up.

Or does the RMagick / Ruby GC go further than that?
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: ImageMagick for Ruby programmers: RMagick vs. MiniMagick

Post by rmagick »

All ImageMagick memory allocations and frees are handed off to Ruby. This means that Ruby's GC knows about all the memory that's in use and free and can run garbage collections accordingly. Image objects are just like arrays, hashes, or any other Ruby objects.

See my post on the RMagick Hints and Tips forum for information about how to enable this support. If you decide to try it please share your experience.
Post Reply