Gambit-C的GC机制是什么?

发布于 2024-11-15 03:50:09 字数 58 浏览 6 评论 0原文

Gambit-C的GC机制是怎样的?我对制作交互式应用程序感到好奇。我想知道是否可以避免突发GC操作。

What's the Gambit-C's GC mechanism? I'm curious about this for making interactive app. I want to know whether it can avoid burst GC operation or not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南渊 2024-11-22 03:50:09

根据这些线程:

Gambit 至少在 2008 年 9 月之前具有传统的 stop-the-world GC。线程中的人们建议使用预分配的对象池来避免 GC 操作本身。我无法了解当前的实施情况。

*很难同意谈话内容。因为我无法池化不是我自己编写的对象,最终,由于积累的小/非池化临时对象,有时会发生full GC。但@Gregory提到的方法可能有助于避免这个问题。不过,我希望增量 GC 添加到 Gambit 中:)

According to these threads:

Gambit has traditional stop-the-world GC at least until September 2008. People in thread recommended using pre-allocated object pooling to avoid GC operation itself. I couldn't find out about current implementation.

*It's hard to agree with the conversation. Because I can't pool object not written by myself and finally full-GC will happen at sometime by accumulated small/non-pooled temporary objects. But the method mentioned by @Gregory may help to avoid this problem. However, I wish incremental GC added to Gambit :)

顾忌 2024-11-22 03:50:09

根据 http://dynamo.iro.umontreal.ca/ ~gambit/wiki/index.php/Debugging#Garbage_collection_threshold gambit 有一些控制:

垃圾收集阈值

注意运行时选项 h(最大堆大小,以千字节为单位)和 l(livepercent)。请参阅参考手册了解更多信息。将 livepercent 设置为 5 意味着当为应该垃圾收集的对象分配的内存比为不应该垃圾收集的对象分配的内存多十九倍时,将进行垃圾收集。 livepercent 选项存在的原因是提供一种方法来控制垃圾收集器在内存消耗方面应如何节省/慷慨,以及 CPU 负载应如何重/轻。

您始终可以通过 (##gc) 强制进行垃圾回收。

如果您在少量操作后强制进行垃圾回收,或者将其安排为接近连续,或者将 livepercent 设置为 90 之类,那么 gc 可能会频繁运行,并且每次运行时不会执行太多操作。总体而言,这可能会更昂贵,但可以避免费用激增。然后,您可以相当轻松地预算该费用,以使服务速度更快。

According to http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Debugging#Garbage_collection_threshold gambit has some controls:

Garbage collection threshold

Pay attention to the runtime options h (maximum heapsize in kilobytes) and l (livepercent). See the reference manual for more information. Setting livepercent to five means that garbage collection will take place at the time that there are nineteen times more memory allocated for objects that should be garbage collected, than there is memory allocated for objects that should not. The reason the livepercent option is there, is to give a way to control how sparing/generous the garbage collector should be about memory consumption, vs. how heavy/light it should be in CPU load.

You can always force garbage collection by (##gc).

If you force garbage collection after some small number of operations, or schedule it near continuously, or set the livepercent to like 90 then presumably the gc will run frequently and not do very much on each run. This is likely to be more expensive overall, but avoid bursts of expense. You can then fairly easily budget for that expense to make the service fast despite.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文