Next: , Previous: GTY Options, Up: Type Information


16.2 Marking Roots for the Garbage Collector

In addition to keeping track of types, the type machinery also locates the global variables that the garbage collector starts at. There are two syntaxes it accepts to indicate a root:

  1. extern GTY (([options])) [type] ID;
  2. static GTY (([options])) [type] ID;

These are the only syntaxes that are accepted. In particular, if you want to mark a variable that is only declared as

int ID;
or similar, you should either make it static or you should create a extern declaration in a header file somewhere.