Erlang Development Environment

Erik Johansson <>
Wed Mar 7 10:04:11 CET 2001

"Robert Virding" <> wrote:

> "Erik.Johansson" <> writes:
> >In fact, when you compile a function to native code with HiPE all
> >data structures are stored in such a memory pool.
> How do you garbage collect this memory pool?  I presume that the idea
> is to NOT a structure from the pool into a process heap.  In that case
> how do you know when to clear structures from the pool?  Just removing
> them when the module is purged is not enough as they may still be
> referenced from process heaps.

Yes in ordinary execution the data in the constant pool is not copied to the
process heap.

When a module, with constant data, is purged the following is done:
 A flag is set in each process indicating that the next GC should be
 This special GC kopies all live terms from the constant area to the process
 When all marked processes have done a special GC then the constant pool is
 (If new processes are created they do not need to do a special GC since
they can't
  get any references to the constnats in question. This assumes that
messages are copied.)

 This scheme is not yet fully implemented in HiPE ;)
 (There are a few parameters that can be tweeked like:
   * Copy all data from the constant pool or just data associated with the
purged module.
   * When to do the next GC.
   * Not copy constant data when doing a send. (This probably cost more than
one can gain.)

> I am assuming here that you using the seperate process heap model of
> the BEAM.  If you are using a single heap then the problem goes away.

Yes, and we plan to experiment with a single heap.


More information about the erlang-questions mailing list