memsup is a process which supervises the memory usage for
the system and for individual processes. It is part of the OS_Mon
application, see os_mon(6).
Available for Unix and Windows.
Periodically performs a memory check:
-
If more than a certain amount of available system memory is
allocated, as reported by the underlying operating system,
the alarm {system_memory_high_watermark, []} is set.
-
If any Erlang process Pid in the system has allocated
more than a certain amount of total system memory, the alarm
{process_memory_high_watermark, Pid} is set.
Alarms are reported to the SASL alarm handler, see
alarm_handler(3).
To set an alarm, alarm_handler:set_alarm(Alarm) is called
where Alarm is either of the alarms specified above.
The alarms are cleared automatically when the alarm cause is no
longer valid.
The function
get_memory_data()
can be used to retrieve the result of the latest periodic memory
check.
There is also a interface to system dependent memory data,
get_system_memory_data().
The result is highly dependent on the underlying operating
system and the interface is targeted primarily for systems
without virtual memory. However, the output on other
systems is still valid, although sparse.
A call to get_system_memory_data/0 is more costly
than a call to get_memory_data/0 as data is collected
synchronously when this function is called.
The total system memory reported under UNIX is the number of
physical pages of memory times the page size, and the available
memory is the number of available physical pages times the page
size. This is a reasonable measure as swapping should be avoided
anyway, but the task of defining total memory and available
memory is difficult because of virtual memory and swapping.