Rev 49852 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/Memory-limits.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2007 R Core Development Team% Distributed under GPL 2 or later\name{Memory-limits}\alias{Memory-limits}\concept{memory}\concept{limits}\title{Memory Limits in R}\description{\R holds objects it is using in memory. This help file documents thecurrent design limitations on large objects: these differ between32-bit and 64-bit builds of \R.}\details{\R holds all objects in memory, and there are limits based on theamount of memory that can be used by all objects:\itemize{\item There may be limits on the size of the heap and the number ofcons cells allowed -- see \code{\link{Memory}} -- but these areusually not imposed.\item There is a limit on the address space of a single process suchas the \R executable. This is system-specific.\item The environment may impose limitations on the resourcesavailable to a single process: Windows' versions of \R do so directly.}Error messages beginning \code{cannot allocate vector of size}indicate a failure to obtain memory, either because the size exceededthe address-space limit for a process or, more likely, because thesystem was unable to provide the memory. Note that on a 32-bit OSthere may well be enough free memory available, but not a large enoughcontiguous block of address space into which to map it.There are also limits on individual objects. On all versions of \R,the maximum length (number of elements) of a vector is\eqn{2^{31} - 1 \approx 2\thinspace 10^9}{2^31 - 1 ~ 2*10^9}, aslengths are stored as signed integers. In addition, the storage spacecannot exceed the address limit, and if you try to exceed that limit,the error message begins \code{cannot allocate vector of length}.The number of characters in a character string is in theory onlylimited by the address space.}\section{Unix}{The address-space limit is system-specific: 32-bit OSesimposes a limit of no more than 4Gb: it is often 3Gb or less. Running32-bit executables on a 64-bit OS will have the similar limits: 64-bitexecutables will have an essentially infinite system-specific limit.See the OS/shell's help on commands such as \code{limit} or\code{ulimit} for how to impose limitations on the resources availableto a single process. For example a \command{bash} user could use\preformatted{ulimit -t 600 -m 2000000}whereas a \command{csh} user might use\preformatted{limit cputime 10mlimit memoryuse 2048m}to limit a process to 10 minutes of CPU time and (around) 2GB of memory.}\section{Windows}{The address space limit is 2Gb under 32-bit Windows unless the OS'sdefault has been changed to allow more (up to 3Gb). See\url{http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx}and\url{http://msdn.microsoft.com/en-us/library/bb613473\%28VS.85\%29.aspx}.Under most 64-bit versions of Windows the limit is 4Gb: for some olderones it is 2Gb.Under Windows, \R imposes limits on the total memory allocationavailable to a single session as the OS provides no way to do so: see\code{\link{memory.size}} and \code{\link{memory.limit}}.}\seealso{\code{\link{object.size}(a)} for the (approximate) size of \R object\code{a}.}\keyword{environment}