list_to_atom use in kernel/error_logger.erl

Matthias Lang <>
Wed Feb 1 22:40:49 CET 2006


Short answer: It's not a problem, the offending code is only 
              executed during the Erlang boot.

Long answer: This seemed like a jolly good opportunity to make the
emulator crash and burn. Alas, it's harder than hoped. 

The manpage for the error_logger hints (see swap_handler) that the
error_handler starts up in a 'primitive' state, before being moved to
'normal' mode. The code you posted is only reachable from that
primitive state, so there's not much scope for logging a bunch of junk
with it. 

If you insist on clogging the works, you can use the undocumented export
error_loger:simple_logger/1 with an integer argument.



Serge Aleynikov writes:
 > I was browsing through the kernel/error_logger.erl and the following 
 > code caught my attention.  Wouldn't the call list_to_atom/1 eventially 
 > lead to exhaustion of the atom table?
 > ----kernel/error_logger.erl (line: 288)-------------------
 > display2(Tag,F,A) ->
 >      erlang:display({error_logger,Tag, nice(F), nice(A)}).
 > nice(X) when tuple(X) ->
 >      nice_tuple(X);
 > nice([]) -> [];
 > nice(L) when list(L) ->
 >      case is_string(L) of
 >      true ->
 >          list_to_atom(L);
 >      false ->
 >          [H|T] = L,
 >          [nice(H) | nice(T)]
 >      end;
 > nice(X) -> X.
 > ----------------------------------------------------------
 > Why does a list need to be converted to atom here?
 > Serge

More information about the erlang-questions mailing list