GNU Compiler Collection (GCC) Internals: GGC Roots |
---|
Next: Files, Previous: User GC, Up: Type Information [Contents][Index]
In addition to keeping track of types, the type machinery also locates the global variables (roots) that the garbage collector starts at. Roots must be declared using one of the following syntaxes:
extern GTY(([options])) type name;
static GTY(([options])) type name;
The syntax
GTY(([options])) type name;
is not accepted. There should be an extern
declaration
of such a variable in a header somewhere—mark that, not the
definition. Or, if the variable is only used in one file, make it
static
.