Open brandonbloom opened 13 years ago
Seems to be the same problem as AASM has: https://github.com/rubyist/aasm/issues/31
This is a huge problem! It makes development pretty painful, grinding to a halt after testing every so often.
I guess that's due to an excessive use of to_sym calls, since symbols aren't garbage collected.
to_sym
does in fact leak, but that shouldn't be an issue if you only call it on a well-known limited-set of strings. It shouldn't be called on unvalidated data from untrusted clients, because someone could pass random large strings over and over again until you run out of memory. However, I'm not so sure that's the issue with enumerated_attribute, since ~10M seems oddly consistent. More likely: The entire models object space is being retained somewhere. Anyway, I'm no longer using this library so I am going to unsubscribe from notifications on this issue.
I found a workaround: when developing, use a gem like active_reload to cut down dramatically on the amount of memory leaked under normal usage. This only reloads classes that have changed, with the side effect of the app being much, much faster.
This issue is still affecting Rails (with 3.1), leaking aroung 30MB every request on a mid-size project.
I recently added enumerated_attribute to my Rails 3 project and it causes it to leak about ~10M of memory on every request.