aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorBasile Starynkevitch <basile@starynkevitch.net>2009-01-14 17:08:47 +0000
committerBasile Starynkevitch <bstarynk@gcc.gnu.org>2009-01-14 17:08:47 +0000
commit7de2b68817f4da9bfbea781339c27c6e832fd087 (patch)
tree5d5f53219fc176c65b96f44122b3de81e00fa6a1 /gcc/doc
parent10bd6c5c4ab2fd182fc4e24ae539a97a9245774f (diff)
downloadgcc-7de2b68817f4da9bfbea781339c27c6e832fd087.zip
gcc-7de2b68817f4da9bfbea781339c27c6e832fd087.tar.gz
gcc-7de2b68817f4da9bfbea781339c27c6e832fd087.tar.bz2
gty.texi (Invoking the garbage collector): Added new node and section documenting ggc_collect.
2009-01-14 Basile Starynkevitch <basile@starynkevitch.net> * doc/gty.texi (Invoking the garbage collector): Added new node and section documenting ggc_collect. From-SVN: r143375
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/gty.texi22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi
index 1793614..c5c0f9e 100644
--- a/gcc/doc/gty.texi
+++ b/gcc/doc/gty.texi
@@ -1,4 +1,4 @@
-@c Copyright (C) 2002, 2003, 2004, 2007, 2008
+@c Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009
@c Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -69,6 +69,7 @@ These don't need to be marked.
* GTY Options:: What goes inside a @code{GTY(())}.
* GGC Roots:: Making global variables GGC roots.
* Files:: How the generated files work.
+* Invoking the garbage collector:: How to invoke the garbage collector.
@end menu
@node GTY Options
@@ -448,3 +449,22 @@ source file. Don't forget to mention this file as a dependency in the
For language frontends, there is another file that needs to be included
somewhere. It will be called @file{gtype-@var{lang}.h}, where
@var{lang} is the name of the subdirectory the language is contained in.
+
+@node Invoking the garbage collector
+@section How to invoke the garbage collector
+@cindex garbage collector, invocation
+@findex ggc_collect
+
+The GCC garbage collector GGC is only invoked explicitly. In contrast
+with many other garbage collectors, it is not implicitly invoked by
+allocation routines when a lot of memory has been consumed. So the
+only way to have GGC reclaim storage it to call the @code{ggc_collect}
+function explicitly. This call is an expensive operation, as it may
+have to scan the entire heap. Beware that local variables (on the GCC
+call stack) are not followed by such an invocation (as many other
+garbage collectors do): you should reference all your data from static
+or external @code{GTY}-ed variables, and it is advised to call
+@code{ggc_collect} with a shallow call stack. The GGC is an exact mark
+and sweep garbage collector (so it does not scan the call stack for
+pointers). In practice GCC passes don't often call @code{ggc_collect}
+themselves, because it is called by the pass manager between passes.