[trunk r143197] patch adding optional extra marking to GGC

Ian Lance Taylor iant@google.com
Wed Jan 14 15:59:00 GMT 2009


"Laurynas Biveinis" <laurynas.biveinis@gmail.com> writes:


> Regardless of the outcome of the discussion for the main part of the
> patch, the documentation part below is useful in itself, maybe you
> could submit it separately.

This doc patch is OK.

Thanks for the suggestion.

Ian

> Index: gcc/doc/gty.texi
> ===================================================================
> --- gcc/doc/gty.texi	(revision 143199)
> +++ gcc/doc/gty.texi	(working copy)
> @@ -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,39 @@ source file.  Don't forget to mention this file as
>  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
> +@findex ggc_collect_extra_marking
> +
> +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.
> +
>
>
> -- 
> Laurynas



More information about the Gcc-patches mailing list