# Calling GC.start with attachment\_fu and RMagick -- where or if?

**URL:** <https://www.ruby-forum.com/t/calling-gc-start-with-attachment-fu-and-rmagick-where-or-if/123110>\
**Category:** Rails\
**Created:** [December 14, 2007, 3:42am UTC](https://www.ruby-forum.com/t/calling-gc-start-with-attachment-fu-and-rmagick-where-or-if/123110 "2007-12-14T03:42:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skaufman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@skaufman](https://www.ruby-forum.com/u/skaufman)\
**Post date:** [December 14, 2007, 3:42am UTC](https://www.ruby-forum.com/t/calling-gc-start-with-attachment-fu-and-rmagick-where-or-if/123110/1 "2007-12-14T03:42:42Z")

</div>

RMagick (and ImageMagick) have been criticized for memory leaks,  
though the problem is avoidable by timely garbage collection – see  
this thread:

[http://groups.google.com/group/rubyonrails-talk/browse\_thread/thread/edee971625603f82/e402fb95de40d54b](http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/edee971625603f82/e402fb95de40d54b)

Attachment\_fu does not call GC.start in any fashion that I can see, so  
my questions are these: does it need to, and if so, where would be the  
optimal place? It appears that  
AttachmentFu::Processors::RmagickProcessor#with\_image may be the right  
method – perhaps in the ensure clause? Somewhere else?

Or should GC.start be called in one’s app at, say, the end of the  
controller create method that uses attachment\_fu – instead of mucking  
about with attachment-fu’s lower-level plumbing?

Or does attachment\_fu handle the needed garbage collection in some  
other way so it’s good to go as is? In a development environment app,  
the attachment\_fu/RMagick stack is working great, but I’d like to  
understand whether I need to do something more before moving to  
production.

Many thanks in advance for any pointers!
