gpt4 book ai didi

memory - erlang:memory() 与 memsup:get_system_memory_data()

转载 作者:行者123 更新时间:2023-12-04 00:32:54 39 4
gpt4 key购买 nike

对不起,我对 erlang 文档中的以下描述不太清楚:

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."

请问这里有没有人更不稳定?

最佳答案

erlang:memory/0,1 显示了 Erlang VM (BEAM) 的当前状态。 memsup:get_system_memory_data/0 显示操作系统的当前状态。

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

这意味着我的 BEAM 在启动后使用了 12.9MB 内存。要获取操作系统内存,您必须启动 os_mon 应用程序。我的操作系统有 7.69GB 可用空间,BEAM 可能会使用这些空间。在启动 os_mon 所需的所有应用程序后,我的 BEAM 使用了 14.7MB。

关于memory - erlang:memory() 与 memsup:get_system_memory_data(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48237818/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com