Skip to content
This repository has been 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

Open
dslztx opened this issue Oct 12, 2016 · 0 comments

Comments

@dslztx
Copy link

dslztx commented Oct 12, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant