File: gcDLLs.Rd

package info (click to toggle)
r-cran-r.utils 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,864 kB
  • sloc: sh: 18; makefile: 6
file content (62 lines) | stat: -rw-r--r-- 1,880 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
% 
%  gcDLLs.R
% 
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\name{gcDLLs}
\alias{gcDLLs}

\alias{strayDLLs}

\title{Identifies and removes DLLs of packages already unloaded}

\description{
  Identifies and removes DLLs of packages already unloaded.
  When packages are unloaded, they are ideally also unloading any
  DLLs (also known as a dynamic shared object or library) they
  have loaded.  Unfortunately, not all package do this resulting
  in "stray" DLLs still being loaded and occupying \R's limited
  registry.  These functions identifies and removes such DLLs.
}

\usage{
gcDLLs(gc=TRUE, quiet=TRUE)
}

\arguments{
 \item{gc}{If \code{\link[base:logical]{TRUE}}, if there are stray DLLs, then the garbage collector is run before unloading those DLLs.  This is done in order to trigger any finalizers, of which some may need those DLLs, to be called.}
 \item{quiet}{If \code{\link[base:logical]{FALSE}}, a message is outputted for every stray DLL that is unloaded.}
}

\value{
  Returns (invisibly) the set of stray DLLs identified.
}

\details{
  If a library fails to unload, an informative warning is generated.
}

\section{How to unload DLLs in package (for package developers)}{
  To unload a package DLL whenever the package in unloaded, add the
  following to your package:
  \preformatted{
  .onUnload <- function(libpath) {
      ## (1) Force finalizers to be called before removing the DLL
      ##     in case some of them need the DLL.
      gc()

      ## (2) Unload the DLL for this package
      library.dynam.unload(.packageName, libpath)
  }
  }
}

\author{Henrik Bengtsson}

\seealso{
  \code{\link[base]{getLoadedDLLs}}().
}