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

Uncontrolled growth of the type variants or extension index lists #136

Closed
halostatue opened this issue Aug 12, 2018 · 0 comments
Closed
Assignees

Comments

@halostatue
Copy link
Member

While investigating #117, #127, and #134, I noticed that the #default_proc usage in MIME::Types::Container could potentially cause uncontrolled growth in memory by the constant querying of unknown types and/or extensions.

MIME::Types::Container was originally a subclass of Hash with a default Proc (->(h, k) { h[k] = Set.new }) and some methods to assist with JSON/YAML encoding and Marshal support (because the presence of the default_proc breaks those things or is missing on restoration).

This particular implementation is extremely useful during construction, because it allowed for the simplification of a number of call-sites, but it had the unintended consequence of recording every missed query and adding an empty (but mutable) Set during normal (and much more frequent) execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant