Atom pollution

Raimo Niskanen <>
Tue Feb 22 11:26:01 CET 2005


There is an "atom hash", or rather there cannot be two atoms with
the same text representation, so when a new atom is created it is
first checked if it exists then it need not be created.

 (Corrado Santoro) writes:

> Dear all,
> 
> I've read that atoms are not garbage collected. But suppose I use the
> following code:
> 
> a(String) -> b(list_to_atom(String)).
> 
> b(hello) -> ...
> b(ciao) -> ...
> b(bonjour) -> ...
> 
> 
> String can be "hello", "ciao" or "bonjour".
> 
> What happens each time a/1 is called? Is a new atom created each time
> or there is a sort of "atom hash"?
> 
> Regards,
> --Corrado
> 
> -- 
> ======================================================
> Eng. Corrado Santoro, Ph.D.
> 
> University of Catania - Engineering Faculty
> Department of Computer Science and
> Telecommunications Engineering
> Viale A. Doria, 6 - 95125 CATANIA (ITALY)
> 
> Tel: +39 095 7382380           Fax: +39 095 7382397
>       +39 095 7382365
>       +39 095 7382364
> 
> EMail: 
> Personal Home Page:
>              http://www.diit.unict.it/users/csanto
> 
> NUXI Home Page:
>              http://nuxi.iit.unict.it
> ======================================================
> 

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list