# Ruby Object/GC Lifecycle

## Interesting typedefs

• VALUE - unsigned long, 8 bytes, can be used for pointers or for actual data.

• I think that types that are defined with _t means that it’s to be treated as an actual type in the system. How does this differ from just passing around a struct?

• Answer - C has namespaces for identifiers! structs, enum variables, typedef’s and other things all have their own separate spaces. So when you define a struct with a name S you always have to refer to it as struct S to tell the compiler which namespace to look in, whereas marking something with typedef puts it in the global namespace.

Every Ruby object is an [rvalue].

Ruby manages it’s memory using two heaps ([ruby-heaps]) consisting of RVALUE objects. These heaps are contained in a struct called rb_objspace_t. [ruby-objspace]

## The initialisation of the heaps

• Ruby starts up and runs Init_GC(), this does a load of stuff, but one of the things it does is [walking-the-heap]