instance_sizeof
Выражение instance_sizeof возвращает Int32 с размером экземпляра заданного класса. Например:
class Point
def initialize(@x, @y)
end
end
Point.new 1, 2
# 2 x Int32 = 2 x 4 = 8
instance_sizeof(Point) # => 12
Несмотря на то, что у экземпляра есть два поля Int32, компилятор всегда включает дополнительное поле Int32 для идентификатора типа объекта. Поэтому размер экземпляра составляет 12, а не 8.
To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.
https://crystal-lang.org/reference/1.2/syntax_and_semantics/instance_sizeof.html