buildin rmagick gem and how to avoid memory leak

If you running Arch Linux you stay up to date all the time! As a down side - frequently broken dependencies once a system lib gets updated. Rmagick gem is a good example!

Once you get an error:

RuntimeError (This version of RMagick was created to run with ImageMagick 6.6.0
    but ImageMagick 6.6.1-4 is installed on this system. You should either
    1) Configure and build RMagick for ImageMagick 6.6.1-4, or
    2) download ImageMagick 6.6.0 from file:///usr/share/doc/ImageMagick-6.6.0/index.html and install it

it’s time to rebuild the gem with its native extension which depend on the updated lib.

Update itself is trivial:

$ sudo gem uninstall rmagick -v 1.15.14
$ gem install rmagick -v 1.15.14 -- --disable-htmldoc

The –disable-htmldoc option is essential if you don’t want spend another couple hours waiting for gem to get built. Turns out that htmldoc building is a huge leak! It’s fixed in latest rmagick gems but for the gem leaking was the case.

PS: I’m using Rmagick v1.15.14 because of our project dependencies.