I believe that is very difficult. This is mentioned in the Java FAQ
http://www.afu.com/java somewhere. There are hacks to do this mentioned
in there, but it doesn't give you the "implementation dependent" size,
it just gives you the size of the object when you serialize it.

-rchit

Bernd Kreimeier wrote:
> 
> Is there an easy way to get the implemtation dependend
> size of a given object? What is the problem with providing
> a method e.g. like
>   public native final int java.lang.Object.sizeOf();
>   public native final int java.lang.Class.sizeInstance();
> anyway?
> 
> Or in other words: what good is Runtime.freeMemory() going
> to do me if I can't get reliable numbers on the memory
> usage for the intended allocation? Might be a question for
> the javares list.
> 
>                                            b.
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to