gpt4 book ai didi

garbage-collection - BEAM(Erlang VM)是否并行进行垃圾收集?

转载 作者:行者123 更新时间:2023-12-04 22:20:26 25 4
gpt4 key购买 nike

我正在学习 Elixir 并希望确保我了解垃圾收集在 Erlang VM 中的工作原理。

我的理解是这样的:

  • 每个 VM 级进程都有自己的堆
  • 如果该堆在终止之前没有填满,它将与进程一起丢弃并且不需要 GC
  • 填满的堆被单独收集,并行 ,所以 GC 不会“停止世界”,只是一个进程

  • 这样对吗?

    最佳答案

    Take garbage collection. When it's time to collect garbage in other languages, the entire system has to stop while the garbage collector runs. This approach is perfectly fine if your computer program is supposed to run once, write some output, and then quit. But in long-running applications, such as desktop, mobile, or server programs, this strategy results in occasionally frozen UIs and slow response times. Erlang programs, on the other hand, can have thousands of independent heaps which are garbage-collected separately; in this way, the performance penalty of garbage collection is spread out over time, and so a long-running application will not mysteriously stop responding from time to time while the garbage collector runs.



    Evan Miller, creator of the popular Chicago Boss framework.

    所以我相信erlang垃圾收集是并发的,即各个堆是相互独立的垃圾收集。是否有任何并行化取决于您的节点是否在多个内核上运行,但如果是,那么垃圾收集是并行完成的,是的。

    关于garbage-collection - BEAM(Erlang VM)是否并行进行垃圾收集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24888599/

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