Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:Plugins   [Contents][Index]


23.4 Interacting with the GCC Garbage Collector

Some plugins may want to be informed when GGC (the GCC GarbageCollector) is running. They can register callbacks for thePLUGIN_GGC_START andPLUGIN_GGC_END events (for whichthe callback is called with a nullgcc_data) to be notified ofthe start or end of the GCC garbage collection.

Some plugins may need to have GGC mark additional data. This can bedone by registering a callback (called with a nullgcc_data)for thePLUGIN_GGC_MARKING event. Such callbacks can call theggc_set_mark routine, preferably through theggc_mark macro(and conversely, these routines should usually not be used in pluginsoutside of thePLUGIN_GGC_MARKING event). Plugins that wish to holdweak references to gc data may also use this event to drop weak references whenthe object is about to be collected. Theggc_marked_p function can beused to tell if an object is marked, or is about to be collected. Thegt_clear_cache overloads which some types define may also be of use inmanaging weak references.

Some plugins may need to add extra GGC root tables, e.g. to handle their ownGTY-ed data. This can be done with thePLUGIN_REGISTER_GGC_ROOTSpseudo-event with a null callback and the extra root table (of typestructggc_root_tab*) asuser_data. Running thegengtype -psource-dirfile-listplugin*.c ...utility generates these extra root tables.

You should understand the details of memory management inside GCCbefore usingPLUGIN_GGC_MARKING orPLUGIN_REGISTER_GGC_ROOTS.


Next:Giving information about a plugin, Previous:Interacting with the pass manager, Up:Plugins   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp