Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

erlang:memory() vs memsup:get_system_memory_data()

Tags:

memory

erlang

excuse me, I'm quite not clear about these below descriptions at the erlang document:

erlang:memory() -> [{Type, Size}]

with Type: "total" means: "The total amount of memory currently allocated. This is the same as the sum of the memory size for processes and system."

memsup:get_system_memory_data() -> MemDataList

MemDataList = [{Tag, Size}] with Tag: "total_memory" means: "The total amount of memory available to the Erlang emulator, allocated and free. May or may not be equal to the amount of memory configured in the system."

Does anyone here please make is more understable please ?

like image 548
zoro Avatar asked Sep 18 '26 22:09

zoro


1 Answers

erlang:memory/0,1 shows the current state of Erlang VM (BEAM). memsup:get_system_memory_data/0 show the current state of OS.

1> erlang:memory(total) / (1 bsl 20).
12.918495178222656
2> memsup:get_system_memory_data().
[]
3> 
=WARNING REPORT==== 13-Jan-2018::10:51:15 ===
OS_MON (memsup) called by <0.61.0>, not started
3> application:ensure_all_started(os_mon).

=PROGRESS REPORT==== 13-Jan-2018::10:51:41 ===
...
=INFO REPORT==== 13-Jan-2018::10:51:41 ===
    alarm_handler: {set,{system_memory_high_watermark,[]}}

4> proplists:get_value(total_memory,memsup:get_system_memory_data()) / (1 bsl 30).
7.691337585449219
5> erlang:memory(total) / (1 bsl 20).
14.661575317382813

It means my BEAM was using 12.9MB memory after the start. For obtaining OS memory you have to start os_mon application. My OS has 7.69GB available which could be potentially used by BEAM. My BEAM was using 14.7MB after started all application necessary for os_mon.

like image 192
Hynek -Pichi- Vychodil Avatar answered Sep 24 '26 08:09

Hynek -Pichi- Vychodil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!