在看sun的jvm代码的时候,有这么一段话
// Portability note: Certain compilers (e.g. gcc) will
// always make classes bigger if it has a superclass, even
// if the superclass does not have any virtual methods or
// instance fields.
因此在这些特定平台上不允许出现继承情况,以防止子类的对象变大。
但是我用了一些简单的情况在gcc上测试,并没有出现注释中的情况。
请大家帮忙解释一下,谢谢。
...全文
1356打赏收藏
问个问题:存在超类时的对象大小
在看sun的jvm代码的时候,有这么一段话 // Portability note: Certain compilers (e.g. gcc) will // always make classes bigger if it has a superclass, even // if the superclass does not have any virtual methods or // instance fields. 因此在这些特定平台上不允许出现继承情况,以防止子类的对象变大。 但是我用