Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove global hash of Menu instances. #1453

Merged
merged 1 commit into from Mar 14, 2012

Conversation

phiggins
Copy link
Contributor

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 }'

parndt added a commit that referenced this pull request Mar 14, 2012
Remove global hash of Menu instances.
@parndt parndt merged commit a2ec030 into refinery:master Mar 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants