E.3 Memory usage of objects

Currently an object consists of an object-header and an array of instance variables. The object-header includes various flags, a reference count and a pointer to the class. The size of an object header is 12 bytes. Each instance variable consumes an additional 4 bytes. For example a point object has `x' and `y' instance variables and thus consumes 12 + 2 * 4 = 20 bytes.

The method `class<-instance_size' returns the size of an instance of this class in bytes. Note that the costs of supporting objects is not considered in this value. For example a box object has instance size:

1 ?- get(class(box), instance_size, S).
S = 72

But a box has an <-area instance variable consuming an additional 28 bytes.