I encountered the same problem with memory bloat about a year ago. I narrowed it down the image processing part of the app (making thumbnails from user-submitted images). I switched from using Rmagic to using imagemagic via the command line, and this solved my problem. I did this by switching from attachment_fu to paperclip.
I read that it had to do with the way garbage collection works in Ruby. Rmagic wraps the Imagemagick C library. The Rmagic Image object only looks like a few bytes to the GC, because its just metadata about the image and all of the real image bits are handled deep down in the imagemagic C library. The Ruby GC thinks you're only using 60 MB of memory, when really you're using 400 MB, and Heroku kills your process. You could try to mess with the garbage collector, but you're best bet is to switch to using the command line interface. On Sep 27, 7:49 am, Keenan Brock <[email protected]> wrote: > Hi dB, > > I've had a ton of success avoiding rmagick all together and using the command > line version for processing images. > > Specifically: cropping and merging multiple images together adding color > gradients. > > I think you can also rotate and add text fairly easily. > > You may be able to steal some ideas from: > > https://github.com/kbrock/monster-avatars > > —Keenan > > > > > > > > On Tuesday, September 27, 2011 at 1:19 AM, dblock wrote: > > I am trying to process larger and larger images on Heroku and starting > > to run into memory limits with RMagick. A 10MB 300dpi image may be > > 400MB in RAM after being loaded with RMagick, so it easily breaks the > > Heroku's 300MB limit on Bamboo. > > > Anyone has any experience with a similar situation? > > > Thx > > dB. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Heroku" group. > > To post to this group, send email to [email protected] > > (mailto:[email protected]). > > To unsubscribe from this group, send email to > > [email protected] > > (mailto:[email protected]). > > For more options, visit this group > > athttp://groups.google.com/group/heroku?hl=en. -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
