[Squeak] How to get the size of any object (sorry too long)

Satoshi NISHIHARA nishis at urban.ne.jp
Tue Nov 10 02:54:52 UTC 1998


Thanks this GREAT HELP!!

Dan Ingalls wrote:
> >Q1.4)
> >getting the byteSize of aMethod, must add methodHeaderSize (4 bytes)
> >So its total is methodHeaderSize + bytesize of aMethod self + size of literals.
> >Is this right?
> 
> No.  The response to size is the size in bytes, including the literal frame and the
4-byte sourcecode pointer at the end.  Just add 4 for the method header.
> 

But sorry for 2 more questions.

ex) 
result := (Point compiledMethodAt: #rounded) size.

Q1.5)
Does this result include its objectHeadersSize?
If not, I think I must add *more* 4 byres as objectHeadersSize 
of an instance of CompiledMethod (4 bytes).

a) byteSize := result (31) + 4.
b) byteSize := result (31) + 4 + 4.

Which is right?


Q1.6)
Must I consider "4 bytes boundary" or not?
If I must, 
c) byteSize := (result + (4 - 1) bitAnd: 4 negated)(32) + 4 + 4.


-- 
--------------------------------------------
$B@>86Ao;N(B (NISHIHARA Satoshi)
e-mail: mailto:nishis at urban.ne.jp
        mailto:tcc00164 at nifty.ne.jp
URL:    http://www.urban.ne.jp/home/nishis/
--------------------------------------------





More information about the Squeak-dev mailing list