resolve/refinerycms — pull request #1453 by phiggins (2012-03-14 02:53:27+00:00)
Title: Remove global hash of Menu instances.

Inside Refinery::Menu's constructor, it was adding each new instance to a global hash. This was used so that MenuItem instances could refer to the Menu they belonged to, but it made it so all Menu and MenuItem instances would never fall out of scope and be garbage collected.

Earlier today I pasted this code in #1341 to demonstrate the problem:

```
rails r 'i = 0 ; loop { Refinery::Menu.new(Refinery::Page.fast_menu) ; p [:menus, Refinery.menus.size, :mem, `ps -o rss= -p #{$$}`.to_i] if (i += 1) % 1000 == 0 }'
```