4 ms·
Except you have to be careful with symbols in Elixir. They don't get cleaned up until a crash. That means in things like Phoenix you aren't supposed to use symb
by jetti 9y ago
Except you have to be careful with symbols in Elixir. They don't get cleaned up until a crash. That means in things like Phoenix you aren't supposed to use symbols as parameter maps in your controllers as a user could easily blow up your memory by making tons o' calls.
EDIT: I would also add that they are the preferred key for Maps when using internal Map structures (ones that you have complete control over and users don't)
- napsterbr 9y agoThat's a "problem" with the erlang vm actually, you have a limit number of allowed atoms (I think 2 million). When receiving user input, you should not let users create arbitrary atoms because this would allow a atom exhaustion attack. In these cases, what we do is assing a "string" map, something like :input["arbitrary_key"] ETA: default is 1 million atoms actually. It can be increased but it's usually a smell/something to be investigated.
- jetti 9y agoGood point that this isn't Elixir specific but any language that runs on the BEAM.