News for hackers. Stuff that matters.
Re:Ruby's rmagick Gem looking for a maintainer by pilif on Wednesday January 19, 2011 @07:27AM (#2119557)
IMHO, there's a huge difference between calling a C library directly and shelling out to an external process.

mini_magick uses Subexec which in turn causes a fork and exec and might, depending on how ruby's backtick operator work, also start a shell which in turn does another exec for the specific ImageMagick binary.

The process startup time alone is a significant overhead and so is the additional memory usage.

In the old days, when I was maintaining a mail server for a free web mail service, I remember the lengths I went through to prevent my MTA from forking for mail delivery due to the huge cost of launching another process.

Re:Ruby's rmagick Gem looking for a maintainer by towelrod on Wednesday January 19, 2011 @10:06AM (#2119904)
I use RMagick for a rails based image repository, and I have to shell out to run the RMagick code because of memory problems. When I used to keep it all in the rails process, those guys would get up to the 2-3G range over the course of a couple of days.

I'll have to check out minimagick, it might be cleaner than what I am doing now.

Re:Ruby's rmagick Gem looking for a maintainer by andrewvc on Wednesday January 19, 2011 @10:10AM (#2119913)
Have you tried manually calling GC.start with rmagick
Re:Ruby's rmagick Gem looking for a maintainer by towelrod on Friday January 21, 2011 @06:09AM (#2127071)
In this particular application, I have to inspect PDF and TIFF files that might have hundreds of pages or frames. These files can be over 100MB easily. Running those through RMagick makes the process blow up to enormous sizes. Even if the memory gets garbage collected, Solaris doesn't really release it.

Its just safer to keep it in a different process.

Re:Ruby's rmagick Gem looking for a maintainer by sohooo on Wednesday January 19, 2011 @08:40AM (#2119678)
Well, the mini_magick documentation mentions that the spawn of a subprocess is the main point of that library:

"Using MiniMagick the ruby processes memory remains small (it spawns ImageMagick’s command line program mogrify which takes up some memory as well, but is much smaller compared to RMagick)"

Forking isn't always bad. See http://tomayko.com/writings/unicorn-is-unix

Re:Ruby's rmagick Gem looking for a maintainer by jonhohle on Wednesday January 19, 2011 @10:04AM (#2119893)
mini_magic has the advantage of not leaking memory all over the place.