1% File src/library/utils/man/memory.size.Rd
2% Part of the R package, https://www.R-project.org
3% Copyright 1995-2018 R Core Team
4% Distributed under GPL 2 or later
5
6\name{memory.size}
7\alias{memory.size}
8\alias{memory.limit}
9\title{Report on Memory Allocation (on Windows)}
10\description{
11  \describe{
12  \item{On MS Windows,}{
13    \code{memory.size()} reports the current or maximum memory allocation of
14    the \code{malloc} function used in this version of \R.
15
16    \code{memory.limit()} reports or increases the limit in force
17    on the total allocation.}
18
19  \item{On non-Windows platforms}{these are
20    stubs which report infinity (\code{\link{Inf}}) with a warning.}
21  }
22}
23\usage{
24memory.size(max = FALSE)
25
26memory.limit(size = NA)
27}
28\arguments{
29  \item{max}{logical.  If \code{TRUE} the maximum amount of memory
30    obtained from the OS is reported, if \code{FALSE} the amount
31    currently in use, if \code{NA} the memory limit.}
32  \item{size}{numeric.  If \code{NA} report the memory limit, otherwise
33    request a new limit, in Mb.  Only values of up to 4095 are allowed on
34    32-bit \R builds, but see \sQuote{Details}.}
35}
36\details{
37  Command-line flag \option{--max-mem-size} sets the maximum value of
38  obtainable memory (including a very small amount of housekeeping
39  overhead).  This cannot exceed 3Gb on 32-bit Windows, and most
40  versions are limited to 2Gb.  The minimum is currently 32Mb.
41
42  If 32-bit \R is run on most 64-bit versions of Windows the maximum
43  value of obtainable memory is just under 4Gb.  For a 64-bit versions
44  of \R under 64-bit Windows the limit is currently 8Tb.
45
46  Memory limits can only be increased.
47
48  Environment variable \env{R_MAX_MEM_SIZE} provides another way to
49  specify the initial limit.
50}
51\value{
52  A number: On Windows, size in Mb (1048576 bytes), rounded to 0.01 Mb for \code{memory.size}
53  and rounded down for \code{memory.limit}.
54  \cr On other platforms: \code{\link{Inf}} always.
55}
56\note{
57  These functions exist on all platforms, but on non-Windows always
58  report infinity as \R does itself provide limits on memory
59  allocation---the OS's own facilities can be used.
60}
61\seealso{
62  \link{Memory-limits} for other limits.
63
64  On Windows: The rw-FAQ for more details and references.
65}
66\examples{
67if(.Platform$OS.type == "windows") withAutoprint({
68memory.size()
69memory.size(TRUE)
70memory.limit()
71})
72}
73\keyword{utilities}
74