Skip to content
This repository was archived by the owner on Dec 13, 2019. It is now read-only.
This repository was archived by the owner on Dec 13, 2019. It is now read-only.

I find a bug in src/java/com/twitter/common/objectsize/ObjectSizeCalculator.java #438

@dslztx

Description

@dslztx

There are some classes as follows:

class A {
    int a;
}


class B extends A {
    long b;
}


class C extends B {
    char c;
}

public class Main
{
public static void main(String[] args)
{
    C c=new C();
    System.out.println(ObjectSizeCalculator.getObjectSize(c));
}
}

In 32 bits JDK,the result of your program execution is 24,but the exact result is 32.
I also write a program for calculating java object size,please take a look at java-object-size

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions