Garbage collection of atoms

Sebastian Strollo seb@REDACTED
Tue Nov 2 10:01:58 CET 1999


Joe Armstrong <joe@REDACTED> writes:

> On Tue, 2 Nov 1999, Mike Williams wrote:
> > 
> > If mod and func are not previously defined you have a programming
> > error. 
> 
>   Well sort of, if you do apply(foo,bar, ...) and the module foo isn't loaded
> then this traps into the error handler which calls the code loader which ...
> which ... and the code then gets loaded.  

At which point the atoms "foo" and "bar" are installed anyway. Which I
think was Mike's original point...


> > I.e. when you do list_to_atom("mod"), you are almost
> > certainly not creating a new atom. So when do you want to
> > dynamically create atoms except when loading code?
> 
>   Convenience, speed etc.
>   
>   The problem is that while this is ok for a small program (one man hacks)
> where the programmer at least should be aware of how many atoms they create
> it doesn't scale. So I guess for big projects creating new ataoms should be
> a "no no" - or at least subject to review.

It wouldn't be too hard to add a really stupid (i.e. inefficient) atom
gc, this could provide input to the question if it is really
needed. Sure it would be a nice feature, it really is one of those
things which always has been discussed but never implemented. Could it
be because the need for it hasn't been that great?

-- Sebastian




More information about the erlang-questions mailing list