I have to get size of object which type I does not know. It's a template where I want to achieve sth like this:
 void sth(T data)
 {
    System.out.println("Data size = ", sizeof(data));
 }
How I can do this in Java?
sizeof - like a C sizeof ;)
I have to get size of object which type I does not know. It's a template where I want to achieve sth like this:
 void sth(T data)
 {
    System.out.println("Data size = ", sizeof(data));
 }
How I can do this in Java?
sizeof - like a C sizeof ;)
It is not an easy task. You have to use java's Instrumentation. 
Here is an example.