Re: [erlang-questions] atom table limit & erlang shell

0 views
Skip to first unread message

Robert Virding

unread,
May 24, 2008, 6:38:04 AM5/24/08
to Howard Yeh, erlang-q...@erlang.org
Hi Howard,

I did a small test on my system, R12B-0 on Windows, with small loop which just created atoms. It crashed the system when the atom table became full, 1048576 entries. Also this was the reason given in the crash dump. Why the shell goes wrong I don't know, could be you do something else which hangs it.

My code:

run(N) ->
    if (N rem 1000) =:= 0 -> io:fwrite("~p\n", [N]);
       true -> ok
    end,
    case catch list_to_atom("a" ++ integer_to_list(N)) of
        A when is_atom(A) -> run(N+1);
        Other -> {Other,N}
    end.

Printed 947000 before it crashes.

Robert


2008/5/24 Howard Yeh <hay...@gmail.com>:
Hi,

What happens if I exceed the atom table limit, and how would I know?

i am doing some code generation, which dynamically create maybe
2000~3000 new atoms (which are reused for later). Would that go over
the limit?

Anyway, it seems that the shell goes into a loop. The function that
does the generation would return properly, but I don't get the prompt
back...

it works fine for smaller test cases, so I am suspecting it might have
something to do with the atom table limit. Can somebody help me to
find out more?

Howard
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions

Howard Yeh

unread,
May 23, 2008, 8:43:03 PM5/23/08
to erlang-q...@erlang.org

Thomas Lindgren

unread,
May 24, 2008, 7:17:16 AM5/24/08
to erlang-q...@erlang.org

--- Howard Yeh <hay...@gmail.com> wrote:

> Hi,
>
> What happens if I exceed the atom table limit, and
> how would I know?

Why not try it? For example,

atom_killer() -> atom_killer(0).

atom_killer(N) ->
list_to_atom(integer_to_list(N)),
atom_killer(N+1).

(Running that on my mac gave a bus error and a crash
dump.)

> i am doing some code generation, which dynamically
> create maybe
> 2000~3000 new atoms (which are reused for later).
> Would that go over
> the limit?

No, the max number is 1048576.

http://www.erlang.org/doc/efficiency_guide/advanced.html

You can also see the amount of memory used for
different purposes with erlang:memory/1, for instance
erlang:memory(atom_used).

Best,
Thomas

Bjorn Gustavsson

unread,
May 26, 2008, 6:16:52 AM5/26/08
to erlang-q...@erlang.org
Thomas Lindgren <thomasl...@yahoo.com> writes:
>
> (Running that on my mac gave a bus error and a crash
> dump.)
>

I have made a small correction, so that there will be
a controlled termination of the emulator if the allowed
number of atoms is exhausted. (That is, there will not
be a bus error, and the crash dump will not be truncated.)

The correction will be included R12B-3.

/Bjorn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB

Reply all
Reply to author
Forward
0 new messages