统一类型系统是否有助于进行垃圾收集 [英] Does Unified Type system help for doing garbage collection
问题描述
C#
具有统一的类型系统,其中所有类型(包括基本类型)都从object
类型继承.
C#
has a unified type system in which all types, including primitive types inherit from object
type.
Java
也具有从object
类型继承的所有类.
Java
also has all of its classes inherited from object
type.
Thinking in java
单根的层次结构使实现垃圾变得更加容易 收藏家
A singly rooted hierarchy makes it much easier to implement a garbage collector
unified type system
或single rooted hierarchy
是否有助于进行垃圾收集,如果可以,如何?
Does,unified type system
or single rooted hierarchy
help for doing Garbage collection and if so how?
推荐答案
垃圾收集器唯一需要的是能够识别对象的大小以及对象中引用的位置(例如,根据类型)
The only thing which a garbage collector needs is to be able to identify the size of an object and where the references in the object are (e.g. from the type)
拥有一种确定方法,可以使其变得更加简单.
Having one way of determining this, can make it much simpler.
这篇关于统一类型系统是否有助于进行垃圾收集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!