为什么大多数JVM gcs不使用refcounts? [英] why don't most JVM gcs use refcounts?

查看:153
本文介绍了为什么大多数JVM gcs不使用refcounts?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么他们不需要它们,如果有人决定实现一个使用它们的虚拟机,他们可能会面临哪些问题? 解决方案

>



  1. 计数引用必须在对象之外完成。

  2. 计数引用很慢。处理w /循环引用的速度更慢,但这并非不可能。仍然很慢。

  3. 计数引用实际上很慢,因为它必须使用CAS +循环

  4. 不计数引用更容易实现,速度更快,与一些操作系统内存页面技巧。
  5. 只要对象没有转义,引用计数可以通过转义分析完全删除。


Why don't they need them, and if someone decided to implement a VM that used them, what problems might they face?

解决方案

  1. Counting references must be done outside the object.
  2. Counting references is slow. Even slower to deal w/ cyclic references but that's not impossible. Still slow.
  3. Counting references is actually very slow since it must use CAS + loop
  4. Not-Counting references is easier to implement and it's faster, esp. with some OS memory page tricks.
  5. Reference counting can be removed altogether by escape analysis, provided the object doesn't escape.

这篇关于为什么大多数JVM gcs不使用refcounts?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆