Thread overview
Size of a class
Oct 18, 2003
Dario
Oct 18, 2003
Sean L. Palmer
Oct 19, 2003
Walter
Oct 20, 2003
Dario
October 18, 2003
How can I find the size of a class?
"Object o; return o.size;" doesn't work. It returns the size of the
reference.
A '.length' field in ClassInfo would be useful (or a '.length' property for
classes).

I need this because I would like to write a function which returns a byte[]
which contains the contents of the class.
We'd have to decide if that variable should include the classinfo pointer
and the "monitor" (what is this "monitor" exactly?).


October 18, 2003
Can't you do "Object.size" ?

That's the problem with references. IMO they should act as if they actually *are* the object they refer to, in all respects except assignment.  I would expect your example "Object o; return o.size;" to return the same thing as "return Object.size;"

There are a whole bunch of things that would be nice to have in the ClassInfo...

Sean

"Dario" <supdar@yahoo.com> wrote in message news:bmrc5d$16c3$2@digitaldaemon.com...
> How can I find the size of a class?
> "Object o; return o.size;" doesn't work. It returns the size of the
> reference.
> A '.length' field in ClassInfo would be useful (or a '.length' property
for
> classes).


October 19, 2003
"Dario" <supdar@yahoo.com> wrote in message news:bmrc5d$16c3$2@digitaldaemon.com...
> How can I find the size of a class?
> "Object o; return o.size;" doesn't work. It returns the size of the
> reference.
> A '.length' field in ClassInfo would be useful (or a '.length' property
for
> classes).
>
> I need this because I would like to write a function which returns a
byte[]
> which contains the contents of the class.
> We'd have to decide if that variable should include the classinfo pointer
> and the "monitor" (what is this "monitor" exactly?).

The size of a class can be obtained from:
    Object foo;
    foo.classinfo.init.length;


October 20, 2003
Walter:
> The size of a class can be obtained from:
>     Object foo;
>     foo.classinfo.init.length;

Thanks!