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

consider not using keys: :atoms #18

Open
norpan opened this issue Mar 15, 2019 · 1 comment
Open

consider not using keys: :atoms #18

norpan opened this issue Mar 15, 2019 · 1 comment

Comments

@norpan
Copy link

norpan commented Mar 15, 2019

JSON decoding is currently done using keys: :atoms which is a bit problematic, since we have dynamic keys in some instances so the number of atoms is not bounded.

From https://github.com/devinus/poison:

You can use the keys: :atoms variant to make sure all atoms are created as needed. However, unless you absolutely know what you're doing, do not do it. Atoms are not garbage-collected, see Erlang Efficiency Guide for more info:

Atoms are not garbage-collected. Once an atom is created, it will never be removed. The emulator will terminate if the limit for the number of atoms (1048576 by default) is reached.

@norpan
Copy link
Author

norpan commented Mar 15, 2019

One alternative would be to use decode(body, as: struct) and pass struct down from all the callers.

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

No branches or pull requests

1 participant