Objects that are known to have long life can be allocated directly in a higher generation, by using
. Note that both these functions have a global effect, i.e. any object allocated after a call to
or within the body of
is allocated in the specified generation, unless it is explicitly allocated in a different generation. Therefore careless use of these functions may lead to allocation of ephemeral garbage in high generations, which is very inefficient. Conversely, if a long-lasting object is allocated to a low generation, it has to survive several garbage collections before being automatically promoted to the next generation.
Interned symbols (and their symbol names) are treated in a special way, because they are assumed to have a long life. They are allocated in the generation specified by
, which defaults to 2.