[Mongrel] Mongrel and memory usage

Bob Hutchison hutch at recursive.ca
Tue Nov 6 08:20:12 EST 2007


Hi,

On 5-Nov-07, at 1:38 PM, Kirk Haines wrote:

> On 11/5/07, Steve Midgley <public at misuse.org> wrote:
>
>> Thanks Kirk - I guess I'm totally OT at this point, but I hadn't  
>> heard
>> about this bug before. From your description this is a specific  
>> problem
>> to the underlying C code implementing shift, which is not found in
>> related functions? So "array.slice!(0)" would be identical in  
>> function
>> to shift but not contain this leak?
>
> Yeah.  It looked to me like whoever wrote the original array.c code
> just forgot something when writing the code, because it's just #shift
> that has the problem.
>
> This bug was fixed, but not until 1.8.6.  I know it is fixed as of at
> least the last couple of patch releases.  I am unsure if it was fixed
> in the original 1.8.6 release, however.

It isn't fixed in the ruby that ships with Leopard:
   1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0]

This hack will fix things.

class Array
   alias :naughty_shift :shift
   def shift
     result = self.first
     self[0] = nil # This is the 'magic'
     self.naughty_shift
     result
   end
end

>

>
>
> Kirk Haines
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

----
Bob Hutchison                  -- tumblelog at http://www.recursive.ca/so/
Recursive Design Inc.          -- weblog at http://www.recursive.ca/hutch
http://www.recursive.ca/       -- works on http://www.raconteur.info/cms-for-static-content/home/




More information about the Mongrel-users mailing list