Memory management options

Rickard Green <>
Mon May 13 17:28:50 CEST 2002

Leonid Timochouk wrote:
> Hello Erlang users,
> I have some questions about memory-related options of "beam":
> (1) It is said that "sl_alloc" may allocate short-living blocks in
>     "mmap"ed areas. What is the advantage of doing this?

Erlang heaps are repeatedly moved due to copying garbage collection.
When these "short lived" memory blocks repeatedly are moved on the
emulator heap they have a tendency to fragment the emulator heap (the
heap of the unix process in which the emulator is run). Especially large
Erlang heaps can cause the emulator heap to grow very much. By placing
short lived memory blocks outside of the emulator heap (in mmap()ped
segments), the fragmentation of the emulator heap will be reduced. The
erl(1) and sl_alloc(3) man pages (R8B-1) can give you some more

> (2) The "+s" option allows us to set the stack size of Erlang processes,
>     but how to read back the default stack size? "erlang:system_info"
>     does not seem to report this figure.

This option was removed when jam was removed (R6). The documentation of
it should have been removed then, but it wasn't. It will be removed in
the next patch.

> (3) The "+h" option sets the heap size for processes. Again, how to read
>    it back? And most important, is it the single heap size for all
>    processes, or a per-process one?

"erlang:process_info(Pid, heap_size)" gives the current heap size of the
process referred to by Pid. This heap contains both the heap and the
stack of the process. The heap grows from the bottom up towards the
stack and vice versa.

> (4) Do all these "+" options allow/require a space between the option
>    key and the argument? The "+A" option does not have a space...

+ options do allow but do not require white-space. Due to a bug some
options (e.g. +A 10) used to fail when option key and argument were
separated by white-space, though. This bug has been fixed in R8B-1.

> Best wishes,
> Dr. L.A.Timochouk
> Computing Laboratory
> University of Kent at Canterbury

Best regards,
Rickard Green, Erlang/OTP

More information about the erlang-questions mailing list