On Thu, Sep 13, 2012 at 12:43 PM, Masterleep <[email protected]> wrote:
> The bug report specifies what is causing the over-allocation and how to fix
> it.  It's pretty specific.

It's pretty specific in terms of what the problem is, but it's not at
all descriptive of what the actual problem is an how to fix it.

In this case, the cause is that ActiveRecord is using unfrozen strings
as keys.  When you use an unfrozen string as a hash key, ruby dups it,
freezes the dup, and uses the frozen dup as the hash key. The simple
fix to reduce the number of allocated strings from columns * (rows +
1) to just columns is to freeze the columns before using them as hash
keys.

Pull request filed: https://github.com/rails/rails/pull/7631

Jeremy

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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/rubyonrails-core?hl=en.

Reply via email to