% 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 the current design limitations on large objects: these differ between 32-bit and 64-bit builds of \R. } \details{ \R holds all objects in memory, and there are limits based on the amount of memory that can be used by all objects: \itemize{ \item There may be limits on the size of the heap and the number of cons cells allowed -- see \code{\link{Memory}} -- but these are usually not imposed. #ifdef unix \item There is a limit on the address space of a single process such as the \R executable. This is system-specific, but 32-bit OSes imposes a limit of no more than 4Gb: it is often 3Gb or less. \item The environment may impose limitations on the resources available to a single process -- see the OS/shell's help on commands such as \code{limit} or \code{ulimit}. #endif #ifdef windows \item There is a limit on the address space of a single process such as the \R executable. This is 2Gb under 32-bit Windows unless the OS's default 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://msdn2.microsoft.com/en-us/library/aa366778.aspx}. (Under some 64-bit versions of Windows the limit is 4Gb: for others it is 2Gb.) \item Under Windows, \R does impose limits on the total memory allocation available to a single run, as the OS provides no way to do so. See \code{\link{memory.size}} and \code{\link{memory.limit}}. #endif } Error messages beginning \code{cannot allocate vector of size} indicate a failure to obtain memory, either because the size exceeded the address-space limit for a process or, more likely, because the system was unable to provide the memory. Note that on a 32-bit OS there may well be enough free memory available, but not a large enough contiguous 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}, as lengths are stored as signed integers. In addition, the storage space cannot 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 only limited by the address space. } \seealso{ \code{\link{object.size}(a)} for the (approximate) size of \R object \code{a}. } \keyword{environment}