You're right, ok. So the memory causing the OOM error isn't actually
on the Ruby heap, but it can't get freed until the opaque object gets
GC'd.

Evan

On Tue, Mar 25, 2008 at 1:20 PM, Kirk Haines <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 25, 2008 at 11:02 AM, Evan Weaver <[EMAIL PROTECTED]> wrote:
>  > >  My hunch is that rmagick is allocating large amounts of RAM ouside of
>  > >  Ruby.  It registers its objects with the interpreter, but the RAM
>  > >  usage in rmagick itself doesn't count against GC_MALLOC_LIMIT because
>  > >  Ruby didn't allocate it, so doesn't know about it.
>  >
>  > It's allocating opaque objects on the Ruby heap but not using Ruby's
>  > built-in malloc? That seems pretty evil.
>
>  Not really.  It's pretty common in extensions.  You alloc your
>  structures in whatever way is appropriate for the library you are
>  using, then use Data_Wrap_Struct with a mark and a free function to
>  hook your stuff into the Ruby garbage collector.
>
>  Your objects are thus known to Ruby as Ruby objects, but you have
>  potentially large chunks of memory that Ruby itself knows nothing
>  about.
>
>
>
>
>  Kirk Haines
>  _______________________________________________
>  Mongrel-users mailing list
>  Mongrel-users@rubyforge.org
>  http://rubyforge.org/mailman/listinfo/mongrel-users
>



-- 
Evan Weaver
Cloudburst, LLC
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to