\Header{gc}{Garbage Collection}
\alias{gcinfo}{gc}
\keyword{environment}{gc}
\begin{Usage}
\begin{verbatim}
gc(verbose = .Options$verbose)
gcinfo(verbose)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{verbose}] logical; if \texttt{TRUE}, the garbage collection prints
statistics about cons cells [in Bytes] and the vector heap [in KBytes].
\end{ldescription}
\end{Arguments}
\begin{Value}
A call of \texttt{gc} causes a garbage collection to take place.
This usually takes place automagically without user intervention.
\texttt{gc} returns a 2*2 matrix with rows \texttt{"Ncells"} (\emph{cons
cells}) and \texttt{"Vcells"} (\emph{vector cells}, 8 bytes each),
and columns \texttt{"free"} and \texttt{"total"}.

The associated function \texttt{gcinfo} sets a flag so that
automatic collection is either silent (\texttt{verbose=FALSE}) or
prints memory use statistics (\texttt{verbose=TRUE}).\end{Value}
\begin{SeeAlso}
\texttt{\Link{Memory}} on \R's memory management  and
\texttt{\Link{gctorture}} if you are an \R\ hacker.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
gc() #- do it now
gcinfo(TRUE) #-- in the future, show when you do it
x <- integer(0); for(i in 1:18) x _ c(x,i,x)
gcinfo(verbose = FALSE)#-- don't show it anymore

( rgc <- gc(TRUE) )
(100*rgc[,"free"])%/% rgc[,"total"] # the percentages
rgc[2,"free"]/ (1024 / 8) # free vector heap in K bytes
\end{ExampleCode}
\end{Examples}

