<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>1999</year><year>2016</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>How to Interpret the Erlang Crash Dumps</title>
    <prepared>Patrik Nyblom</prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date>1999-11-11</date>
    <rev>PA1</rev>
    <file>crash_dump.xml</file>
  </header>
  <p>This section describes the <c><![CDATA[erl_crash.dump]]></c> file
    generated upon abnormal exit of the Erlang runtime system.</p>

  <note>
    <p>The Erlang crash dump had a major facelift in Erlang/OTP R9C. The
      information in this section is therefore not directly applicable for
      older dumps. However, if you use <seealso marker="observer:crashdump_viewer">
      <c>crashdump_viewer(3)</c></seealso> on older dumps,
      the crash dumps are translated into a format similar to this.</p>
  </note>

  <p>The system writes the crash dump in the current directory of
    the emulator or in the file pointed out by the environment variable
    (whatever that means on the current operating system)
    <c>ERL_CRASH_DUMP</c>. For a crash dump to be written, a
    writable file system must be mounted.</p>

  <p>Crash dumps are written mainly for one of two reasons: either the
    built-in function <c><![CDATA[erlang:halt/1]]></c> is called explicitly
    with a string argument from running Erlang code, or the runtime
    system has detected an error that cannot be handled. The most
    usual reason that the system cannot handle the error is that the
    cause is external limitations, such as running out of memory. A
    crash dump caused by an internal error can be caused by the system
    reaching limits in the emulator itself (like the number of atoms
    in the system, or too many simultaneous ETS tables). Usually the
    emulator or the operating system can be reconfigured to avoid the
    crash, which is why interpreting the crash dump correctly is
    important.</p>

  <p>On systems that support OS signals, it is also possible to stop
    the runtime system and generate a crash dump by sending the <c>SIGUSR1</c>
    signal.</p>

  <p>The Erlang crash dump is a readable text file, but it can be difficult
    to read. Using the Crashdump Viewer tool in the
    <c><![CDATA[Observer]]></c> application simplifies the task. This is a
    wx-widget-based tool for browsing Erlang crash dumps.</p>

  <section>
    <marker id="general_info"></marker>
    <title>General Information</title>
    <p>The first part of the crash dump shows the following:</p>

    <list type="bulleted">
      <item>The creation time for the dump</item>
      <item>A slogan indicating the reason for the dump</item>
      <item>The system version of the node from which the dump originates</item>
      <item>The compile time of the emulator running the originating node</item>
      <item>The number of atoms in the atom table</item>
      <item>The runtime system thread that caused the crash dump</item>
    </list>

    <section>
      <title>Reasons for Crash Dumps (Slogan)</title>
      <p>The reason for the dump is shown in the beginning of the file as:</p>

      <pre>
Slogan: &lt;reason&gt;</pre>

      <p>If the system is halted by the BIF
        <c><![CDATA[erlang:halt/1]]></c>, the slogan is the string parameter
        passed to the BIF, otherwise it is a description generated by
        the emulator or the (Erlang) kernel. Normally the message
        is enough to understand the problem, but
        some messages are described here. Notice that the
        suggested reasons for the crash are <em>only suggestions</em>.
        The exact reasons for the errors can vary
        depending on the local applications and the underlying
        operating system.</p>

      <taglist>
        <tag><em>&lt;A&gt;: Cannot allocate &lt;N&gt; bytes of memory (of type
           "&lt;T&gt;")</em></tag>
        <item>
          <p>The system has run out of memory. &lt;A&gt; is the allocator that
            failed to allocate memory, &lt;N&gt; is the number of bytes that
            &lt;A&gt; tried to allocate, and &lt;T&gt; is the memory block
            type that the memory was needed for. The most common case is
            that a process stores huge amounts of data. In this case
            &lt;T&gt; is most often <c><![CDATA[heap]]></c>,
            <c><![CDATA[old_heap]]></c>, <c><![CDATA[heap_frag]]></c>, or
            <c><![CDATA[binary]]></c>. For more information on allocators, see
            <seealso marker="erts_alloc"><c>erts_alloc(3)</c></seealso>.</p>
        </item>
        <tag><em>&lt;A&gt;: Cannot reallocate &lt;N&gt; bytes of memory (of
          type "&lt;T&gt;")</em></tag>
        <item>
          <p>Same as above except that memory was reallocated
            instead of allocated when the system ran out of memory.</p>
        </item>
        <tag><em>Unexpected op code &lt;N&gt;</em></tag>
        <item>
          <p>Error in compiled code, <c><![CDATA[beam]]></c> file damaged, or
            error in the compiler.</p>
        </item>
        <tag><em>Module &lt;Name&gt; undefined <c><![CDATA[|]]></c> Function
          &lt;Name&gt; undefined <c><![CDATA[|]]></c> No function
          &lt;Name&gt;:&lt;Name&gt;/1 <c><![CDATA[|]]></c> No function
          &lt;Name&gt;:start/2</em></tag>
        <item>
          <p>The Kernel/STDLIB applications are
            damaged or the start script is damaged.</p>
        </item>
        <tag><em>Driver_select called with too large file descriptor
          <c><![CDATA[N]]></c></em></tag>
        <item>
          <p>The number of file descriptors for sockets
            exceeds 1024 (Unix only). The limit on file descriptors in
            some Unix flavors can be set to over 1024, but only 1024
            sockets/pipes can be used simultaneously by Erlang (because of
            limitations in the Unix <c><![CDATA[select]]></c> call). The number
            of open regular files is not affected by this.</p>
        </item>
        <tag><em>Received SIGUSR1</em></tag>
        <item>
          <p>Sending the <c>SIGUSR1</c> signal to an Erlang machine (Unix only)
            forces a crash dump. This slogan reflects that the Erlang machine
            crash-dumped because of receiving that signal.</p>
        </item>
        <tag><em>Kernel pid terminated (&lt;Who&gt;) (&lt;Exit
          reason&gt;)</em></tag>
        <item>
          <p>The kernel supervisor has detected a failure, usually that the
            <c><![CDATA[application_controller]]></c> has shut down
            (<c><![CDATA[Who]]></c> = <c><![CDATA[application_controller]]></c>,
            <c><![CDATA[Why]]></c> = <c><![CDATA[shutdown]]></c>).
            The application controller
            can have shut down for many reasons, the most usual
            is that the node name of the distributed Erlang node is
            already in use. A complete supervisor tree "crash" (that is,
            the top supervisors have exited) gives about the same
            result. This message comes from the Erlang code and not from
            the virtual machine itself. It is always because of some
            failure in an application, either within OTP or a
            "user-written" one. Looking at the error log for your
            application is probably the first step to take.</p>
        </item>
        <tag><em>Init terminating in do_boot ()</em></tag>
        <item>
          <p>The primitive Erlang boot sequence was terminated, most probably
            because the boot script has errors or cannot be read. This is
            usually a configuration error; the system can have been started
            with a faulty <c><![CDATA[-boot]]></c> parameter or with a boot
            script from the wrong OTP version.</p>
        </item>
        <tag><em>Could not start kernel pid (&lt;Who&gt;) ()</em></tag>
        <item>
          <p>One of the kernel processes could not start. This is probably
            because of faulty arguments (like errors in a
            <c><![CDATA[-config]]></c> argument)
            or faulty configuration files. Check that all files are in
            their correct location and that the configuration files (if
            any) are not damaged. Usually messages are also
            written to the controlling terminal and/or the error log
            explaining what is wrong.</p>
        </item>
      </taglist>

      <p>Other errors than these can occur, as the
        <c><![CDATA[erlang:halt/1]]></c> BIF can generate any message. If the
        message is not generated by the BIF and does not occur in the
        list above, it can be because of an error in the emulator. There
        can however be unusual messages, not mentioned here, which
        are still connected to an application failure. There is much
        more information available, so a thorough reading of the
        crash dump can reveal the crash reason. The size of processes,
        the number of ETS tables, and the Erlang data on each process
        stack can be useful to find the problem.</p>
    </section>

    <section>
      <title>Number of Atoms</title>
      <p>The number of atoms in the system at the time of the crash is
        shown as <em>Atoms: &lt;number&gt;</em>. Some ten thousands atoms is
        perfectly normal, but more can indicate that the BIF
        <c><![CDATA[erlang:list_to_atom/1]]></c> is used to generate many
        <em>different</em> atoms dynamically, which is never a good idea.</p>
    </section>
  </section>

  <section>
    <marker id="scheduler"></marker>
    <title>Scheduler Information</title>
    <p>Under the tag <em>=scheduler</em> is shown information about the current
      state and statistics of the schedulers in the runtime system. On
      operating systems that allow suspension of other threads, the
      data within this section reflects what the runtime system looks like
      when a crash occurs.</p>

    <p>The following fields can exist for a process:</p>

    <taglist>
      <tag><em>=scheduler:id</em></tag>
      <item>
        <p>Heading. States the scheduler identifier.</p>
      </item>
      <tag><em>Scheduler Sleep Info Flags</em></tag>
      <item>
        <p>If empty, the scheduler was doing some work.
          If not empty, the scheduler is either in some state of sleep,
          or suspended. This entry is only present in an SMP-enabled
          emulator.</p>
      </item>
      <tag><em>Scheduler Sleep Info Aux Work</em></tag>
      <item>
        <p>If not empty, a scheduler internal auxiliary work is scheduled
          to be done.</p>
      </item>
      <tag><em>Current Port</em></tag>
      <item>
        <p>The port identifier of the port that is currently
          executed by the scheduler.</p>
      </item>
      <tag><em>Current Process</em></tag>
      <item>
        <p>The process identifier of the process that is currently
          executed by the scheduler. If there is such a process, this entry is
          followed by the <em>State</em>, <em>Internal State</em>,
          <em>Program Counter</em>, and <em>CP</em> of that same process.
          The entries are described in section
          <seealso marker="#processes">Process Information</seealso>.</p>
        <p>Notice that this is a snapshot of what the entries are exactly when
          the crash dump is starting to be generated. Therefore they are most
          likely different (and more telling) than the entries for the same
          processes found in the <em>=proc</em> section. If there is no
          currently running process, only the <em>Current Process</em> entry is
          shown.</p>
      </item>
      <tag><em>Current Process Limited Stack Trace</em></tag>
      <item>
        <p>This entry is shown only if there is a current process. It is
          similar to <seealso marker="#proc_data">
          <em>=proc_stack</em></seealso>, except that only the function frames
          are shown (that is, the stack variables are omitted).
          Also, only the top and bottom part of the stack are shown. If the
          stack is small (&lt; 512 slots), the entire stack is shown. Otherwise
          the entry <em>skipping ## slots</em> is shown, where <c>##</c>
          is replaced by the number of slots that has been skipped.</p>
      </item>
      <tag><em>Run Queue</em></tag>
      <item>
        <p>Shows statistics about how many processes and ports
          of different priorities are scheduled on this scheduler.</p>
      </item>
      <tag><em>** crashed **</em></tag>
      <item>
        <p>This entry is normally not shown. It signifies that getting the rest
          of the information about this scheduler failed for some reason.</p>
      </item>
    </taglist>
  </section>

  <section>
    <marker id="memory"></marker>
    <title>Memory Information</title>
    <p>Under the tag <em>=memory</em> is shown information similar
      to what can be obtainted on a living node with
      <seealso marker="erts:erlang#erlang:memory/0">
      <c>erlang:memory()</c></seealso>.</p>
  </section>

  <section>
    <marker id="internal_tables"></marker>
    <title>Internal Table Information</title>
    <p>Under the tags <em>=hash_table:&lt;table_name&gt;</em> and
      <em>=index_table:&lt;table_name&gt;</em> is shown internal
      tables. These are mostly of interest for runtime system developers.</p>
  </section>

  <section>
    <marker id="allocated_areas"></marker>
    <title>Allocated Areas</title>
    <p>Under the tag <em>=allocated_areas</em> is shown information
      similar to what can be obtained on a living node with
      <seealso marker="erts:erlang#system_info_allocated_areas">
      <c>erlang:system_info(allocated_areas)</c></seealso>.</p>
  </section>

  <section>
    <marker id="allocator"></marker>
    <title>Allocator</title>
    <p>Under the tag <em>=allocator:&lt;A&gt;</em> is shown
      various information about allocator &lt;A&gt;. The information
      is similar to what can be obtained on a living node with
      <seealso marker="erts:erlang#system_info_allocator_tuple">
      <c>erlang:system_info({allocator, &lt;A&gt;})</c></seealso>.
      For more information, see also
      <seealso marker="erts_alloc"><c>erts_alloc(3)</c></seealso>.</p>
  </section>

  <section>
    <marker id="processes"></marker>
    <title>Process Information</title>
    <p>The Erlang crashdump contains a listing of each living Erlang
      process in the system. The following fields can exist for a process:</p>

    <taglist>
      <tag><em>=proc:&lt;pid&gt;</em></tag>
      <item>
        <p>Heading. States the process identifier.</p>
      </item>
      <tag><em>State</em></tag>
      <item>
        <p>The state of the process. This can be one of the following:</p>
        <taglist>
          <tag><em>Scheduled</em></tag>
          <item>The process was scheduled to run
            but is currently not running ("in the run queue").</item>
          <tag><em>Waiting</em></tag>
          <item>The process was waiting for
            something (in <c><![CDATA[receive]]></c>).</item>
          <tag><em>Running</em></tag>
          <item>The process was currently running.
            If the BIF <c><![CDATA[erlang:halt/1]]></c> was called, this was
            the process calling it.</item>
          <tag><em>Exiting</em></tag>
          <item>The process was on its way to exit.</item>
          <tag><em>Garbing</em></tag>
          <item>This is bad luck, the process was
            garbage collecting when the crash dump was written. The rest
            of the information for this process is limited.</item>
          <tag><em>Suspended</em></tag>
          <item>The process is suspended, either
            by the BIF <c><![CDATA[erlang:suspend_process/1]]></c> or because
            it tries to write to a busy port.</item>
        </taglist>
      </item>
      <tag><em>Registered name</em></tag>
      <item>
        <p>The registered name of the process, if any.</p>
      </item>
      <tag><em>Spawned as</em></tag>
      <item>
        <p>The entry point of the process, that is, what function was
          referenced in the <c><![CDATA[spawn]]></c> or
          <c><![CDATA[spawn_link]]></c> call that
          started the process.</p>
      </item>
      <tag><em>Last scheduled in for | Current call</em></tag>
      <item>
        <p>The current function of the process. These fields do not
          always exist.</p>
      </item>
      <tag><em>Spawned by</em></tag>
      <item>
        <p>The parent of the process, that is, the process that executed
          <c><![CDATA[spawn]]></c> or <c><![CDATA[spawn_link]]></c>.</p>
      </item>
      <tag><em>Started</em></tag>
      <item>
        <p>The date and time when the process was started.</p>
      </item>
      <tag><em>Message queue length</em></tag>
      <item>
        <p>The number of messages in the process' message queue.</p>
      </item>
      <tag><em>Number of heap fragments</em></tag>
      <item>
        <p>The number of allocated heap fragments.</p>
      </item>
      <tag><em>Heap fragment data</em></tag>
      <item>
        <p>Size of fragmented heap data. This is data either created by
          messages sent to the process or by the Erlang BIFs. This
          amount depends on so many things that this field is utterly
          uninteresting.</p>
      </item>
      <tag><em>Link list</em></tag>
      <item>
        <p>Process IDs of processes linked to this one. Can also contain
          ports. If process monitoring is used, this field also tells in
          which direction the monitoring is in effect. That is, a link
          "to" a process tells you that the "current" process was
          monitoring the other, and a link "from" a process tells you
         that the other process was monitoring the current one.</p>
      </item>
      <tag><em>Reductions</em></tag>
      <item>
        <p>The number of reductions consumed by the process.</p>
      </item>
      <tag><em>Stack+heap</em></tag>
      <item>
        <p>The size of the stack and heap (they share memory segment).</p>
      </item>
      <tag><em>OldHeap</em></tag>
      <item>
        <p>The size of the "old heap". The Erlang virtual machine uses
          generational garbage collection with two generations. There is
          one heap for new data items and one for the data that has
          survived two garbage collections. The assumption (which is
          almost always correct) is that data surviving two garbage
          collections can be "tenured" to a heap more seldom garbage
          collected, as they will live for a long period. This is a
          usual technique in virtual machines. The sum of the
          heaps and stack together constitute most of the
          allocated memory of the process.</p>
      </item>
      <tag><em>Heap unused, OldHeap unused</em></tag>
      <item>
        <p>The amount of unused memory on each heap. This information is
          usually useless.</p>
      </item>
      <tag><em>Memory</em></tag>
      <item>
        <p>The total memory used by this process. This includes call stack,
          heap, and internal structures. Same as
          <seealso marker="erlang#process_info-2">
          <c>erlang:process_info(Pid,memory)</c></seealso>.</p>
      </item>
      <tag><em>Program counter</em></tag>
      <item>
        <p>The current instruction pointer. This is only of interest for
          runtime system developers. The function into which the program
          counter points is the current function of the process.</p>
      </item>
      <tag><em>CP</em></tag>
      <item>
        <p>The continuation pointer, that is, the return address for the
          current call. Usually useless for other than runtime system
          developers. This can be followed by the function into which
          the CP points, which is the function calling the current
          function.</p>
      </item>
      <tag><em>Arity</em></tag>
      <item>
        <p>The number of live argument registers. The argument registers
          if any are live will follow. These can contain the arguments
          of the function if they are not yet moved to the stack.</p>
      </item>
      <tag><em>Internal State</em></tag>
      <item>
        <p>A more detailed internal representation of the state of
          this process.</p>
      </item>
    </taglist>
    <p>See also section <seealso marker="#proc_data">Process Data</seealso>.</p>
  </section>

  <section>
    <marker id="ports"></marker>
    <title>Port Information</title>
    <p>This section lists the open ports, their owners, any linked
      processes, and the name of their driver or external process.</p>
  </section>

  <section>
    <marker id="ets_tables"></marker>
    <title>ETS Tables</title>
    <p>This section contains information about all the ETS tables in
      the system. The following fields are of interest for each table:</p>

    <taglist>
      <tag><em>=ets:&lt;owner&gt;</em></tag>
      <item>
        <p>Heading. States the table owner (a process identifier).</p>
      </item>
      <tag><em>Table</em></tag>
      <item>
        <p>The identifier for the table. If the table is a
          <c><![CDATA[named_table]]></c>, this is the name.</p>
      </item>
      <tag><em>Name</em></tag>
      <item>
        <p>The table name, regardless of if it is a
          <c><![CDATA[named_table]]></c> or not.</p>
      </item>
      <tag><em>Hash table, Buckets</em></tag>
      <item>
        <p>If the table is a hash table, that is, if it is not an
          <c><![CDATA[ordered_set]]></c>.</p>
      </item>
      <tag><em>Hash table, Chain Length</em></tag>
      <item>
        <p>If the table is a hash table. Contains statistics about the
          table, such as the maximum, minimum, and average chain length.
          Having a maximum much larger than the average, and a standard
          deviation much larger than the expected standard deviation is
          a sign that the hashing of the terms
          behaves badly for some reason.</p>
      </item>
      <tag><em>Ordered set (AVL tree), Elements</em></tag>
      <item>
        <p>If the table is an <c><![CDATA[ordered_set]]></c>. (The
          number of elements is the same as the number of objects in the
          table.)</p>
      </item>
      <tag><em>Fixed</em></tag>
      <item>
        <p>If the table is fixed using
          <seealso marker="stdlib:ets#safe_fixtable/2">
          <c>ets:safe_fixtable/2</c></seealso> or some internal mechanism.</p>
      </item>
      <tag><em>Objects</em></tag>
      <item>
        <p>The number of objects in the table.</p>
      </item>
      <tag><em>Words</em></tag>
      <item>
        <p>The number of words (usually 4 bytes/word) allocated to data
          in the table.</p>
      </item>
      <tag><em>Type</em></tag>
      <item>
        <p>The table type, that is, <c>set</c>, <c>bag</c>,
          <c>dublicate_bag</c>, or <c>ordered_set</c>.</p>
      </item>
      <tag><em>Compressed</em></tag>
      <item>
        <p>If the table was compressed.</p>
      </item>
      <tag><em>Protection</em></tag>
      <item>
        <p>The protection of the table.</p>
      </item>
      <tag><em>Write Concurrency</em></tag>
      <item>
        <p>If <c>write_concurrency</c> was enabled for the table.</p>
      </item>
      <tag><em>Read Concurrency</em></tag>
      <item>
        <p>If <c>read_concurrency</c> was enabled for the table.</p>
      </item>
    </taglist>
  </section>

  <section>
    <marker id="timers"></marker>
    <title>Timers</title>
    <p>This section contains information about all the timers started
      with the BIFs <c><![CDATA[erlang:start_timer/3]]></c> and
      <c><![CDATA[erlang:send_after/3]]></c>. The following fields exist
      for each timer:</p>

    <taglist>
      <tag><em>=timer:&lt;owner&gt;</em></tag>
      <item>
        <p>Heading. States the timer owner (a process identifier),
          that is, the process to receive the message when the timer
          expires.</p>
      </item>
      <tag><em>Message</em></tag>
      <item>
        <p>The message to be sent.</p>
      </item>
      <tag><em>Time left</em></tag>
      <item>
        <p>Number of milliseconds left until the message would have been
          sent.</p>
      </item>
    </taglist>
  </section>

  <section>
    <marker id="distribution_info"></marker>
    <title>Distribution Information</title>
    <p>If the Erlang node was alive, that is, set up for communicating
      with other nodes, this section lists the connections that were
      active. The following fields can exist:</p>

    <taglist>
      <tag><em>=node:&lt;node_name&gt;</em></tag>
      <item>
        <p>The node name.</p>
      </item>
      <tag><em>no_distribution</em></tag>
      <item>
        <p>If the node was not distributed.</p>
      </item>
      <tag><em>=visible_node:&lt;channel&gt;</em></tag>
      <item>
        <p>Heading for a visible node, that is, an alive node with a
          connection to the node that crashed. States the channel number
          for the node.</p>
      </item>
      <tag><em>=hidden_node:&lt;channel&gt;</em></tag>
      <item>
        <p>Heading for a hidden node. A hidden node is the same as a
          visible node, except that it is started with the <c>"-hidden"</c>
          flag. States the channel number for the node.</p>
      </item>
      <tag><em>=not_connected:&lt;channel&gt;</em></tag>
      <item>
        <p>Heading for a node that was connected to the crashed
          node earlier. References (that is, process or port identifiers)
          to the not connected node existed at the time of the crash.
          States the channel number for the node.</p>
      </item>
      <tag><em>Name</em></tag>
      <item>
        <p>The name of the remote node.</p>
      </item>
      <tag><em>Controller</em></tag>
      <item>
        <p>The port controlling communication with the remote node.</p>
      </item>
      <tag><em>Creation</em></tag>
      <item>
        <p>An integer (1-3) that together with the node name identifies
          a specific instance of the node.</p>
      </item>
      <tag><em>Remote monitoring: &lt;local_proc&gt;  &lt;remote_proc&gt;</em>
      </tag>
      <item>
        <p>The local process was monitoring the remote process at the
          time of the crash.</p>
      </item>
      <tag><em>Remotely monitored by: &lt;local_proc&gt;
        &lt;remote_proc&gt;</em></tag>
      <item>
        <p>The remote process was monitoring the local process at the
          time of the crash.</p>
      </item>
      <tag><em>Remote link: &lt;local_proc&gt; &lt;remote_proc&gt;</em></tag>
      <item>
        <p>A link existed between the local process and the remote
          process at the time of the crash.</p>
      </item>
    </taglist>
  </section>

  <section>
    <marker id="loaded_modules"></marker>
    <title>Loaded Module Information</title>
    <p>This section contains information about all loaded modules.</p>

    <p>First, the memory use by the loaded code is summarized:</p>

    <taglist>
      <tag><em>Current code</em></tag>
      <item>
        <p>Code that is the current latest version of the modules.</p>
      </item>
      <tag><em>Old code</em></tag>
      <item>
        <p>Code where there exists a newer version in the
          system, but the old version is not yet purged.</p>
      </item>
    </taglist>

    <p>The memory use is in bytes.</p>

    <p>Then, all loaded modules are listed. The following fields exist:</p>

    <taglist>
      <tag><em>=mod:&lt;module_name&gt;</em></tag>
      <item>
        <p>Heading. States the module name.</p>
      </item>
      <tag><em>Current size</em></tag>
      <item>
        <p>Memory use for the loaded code, in bytes.</p>
      </item>
      <tag><em>Old size</em></tag>
      <item>
        <p>Memory use for the old code, if any.</p>
      </item>
      <tag><em>Current attributes</em></tag>
      <item>
        <p>Module attributes for the current code. This field is decoded
          when looked at by the Crashdump Viewer tool.</p>
      </item>
      <tag><em>Old attributes</em></tag>
      <item>
        <p>Module attributes for the old code, if any. This field is
          decoded when looked at by the Crashdump Viewer tool.</p>
      </item>
      <tag><em>Current compilation info</em></tag>
      <item>
        <p>Compilation information (options) for the current code. This
          field is decoded when looked at by the Crashdump Viewer tool.</p>
      </item>
      <tag><em>Old compilation info</em></tag>
      <item>
        <p>Compilation information (options) for the old code, if
          any. This field is decoded when looked at by the Crashdump
          Viewer tool.</p>
      </item>
    </taglist>
  </section>

  <section>
    <marker id="funs"></marker>
    <title>Fun Information</title>
    <p>This section lists all funs. The following fields exist for each fun:</p>

    <taglist>
      <tag><em>=fun</em></tag>
      <item>
        <p>Heading.</p>
      </item>
      <tag><em>Module</em></tag>
      <item>
        <p>The name of the module where the fun was defined.</p>
      </item>
      <tag><em>Uniq, Index</em></tag>
      <item>
        <p>Identifiers.</p>
      </item>
      <tag><em>Address</em></tag>
      <item>
        <p>The address of the fun's code.</p>
      </item>
      <tag><em>Native_address</em></tag>
      <item>
        <p>The address of the fun's code when HiPE is enabled.</p>
      </item>
      <tag><em>Refc</em></tag>
      <item>
        <p>The number of references to the fun.</p>
      </item>
    </taglist>
  </section>

  <section>
    <marker id="proc_data"></marker>
    <title>Process Data</title>
    <p>For each process there is at least one <em>=proc_stack</em>
      and one <em>=proc_heap</em> tag, followed by the raw memory
      information for the stack and heap of the process.</p>

    <p>For each process there is also a <em>=proc_messages</em>
      tag if the process message queue is non-empty, and a
      <em>=proc_dictionary</em> tag if the process dictionary (the
      <c><![CDATA[put/2]]></c> and <c><![CDATA[get/1]]></c> thing) is
      non-empty.</p>

    <p>The raw memory information can be decoded by the Crashdump
      Viewer tool. You can then see the stack dump, the
      message queue (if any), and the dictionary (if any).</p>

    <p>The stack dump is a dump of the Erlang process stack. Most of
      the live data (that is, variables currently in use) are placed on
      the stack; thus this can be interesting. One has to
      "guess" what is what, but as the information is symbolic,
      thorough reading of this information can be useful. As an
      example, we can find the state variable of the Erlang primitive
      loader online <c><![CDATA[(5)]]></c> and <c><![CDATA[(6)]]></c>
      in the following example:</p>

    <code type="none"><![CDATA[
(1)  3cac44   Return addr 0x13BF58 (<terminate process normally>)
(2)  y(0)     ["/view/siri_r10_dev/clearcase/otp/erts/lib/kernel/ebin",
(3)            "/view/siri_r10_dev/clearcase/otp/erts/lib/stdlib/ebin"]
(4)  y(1)     <0.1.0>
(5)  y(2)     {state,[],none,#Fun<erl_prim_loader.6.7085890>,undefined,#Fun<erl_prim_loader.7.9000327>,
(6)            #Fun<erl_prim_loader.8.116480692>,#Port<0.2>,infinity,#Fun<erl_prim_loader.9.10708760>}
(7)  y(3)     infinity    ]]></code>

    <p>When interpreting the data for a process, it is helpful to know
      that anonymous function objects (funs) are given the following:</p>

    <list type="bulleted">
      <item>A name constructed from the name of the function in which they are
        created
      </item>
      <item>A number (starting with 0) indicating the number of that fun within
        that function
      </item>
    </list>
  </section>

  <section>
    <marker id="atoms"></marker>
    <title>Atoms</title>
    <p>This section presents all the atoms in the system. This is only
      of interest if one suspects that dynamic generation of atoms can
      be a problem, otherwise this section can be ignored.</p>

    <p>Notice that the last created atom is shown first.</p>
  </section>

  <section>
    <title>Disclaimer</title>
    <p>The format of the crash dump evolves between OTP releases.
      Some information described here may not apply to your
      version. A description like this will never be complete; it is meant as
      an explanation of the crash dump in general and as a help
      when trying to find application errors, not as a complete
      specification.</p>
  </section>
</chapter>

