R 環境內存限制的更改


  由於R語言非常消耗內存,所以做較大數據的處理時需要增加內存空間,有以下種方式:

  一、  在未開啟R之前,在cmd中,輸入下面指令

1 r −−max−mem− s i z e =4Gb

  二、  在開啟R之后,可以使用memory.limit()函數,該函數中數據數字,就是申請內存的大小,以MB為單位

1 memory.limit(4096)

  下面附上memory.limit()函數的文檔

memory.size {utils} R Documentation

Report on Memory Allocation

Description

memory.size reports the current or maximum memory allocation of the malloc function used in this version of R.

memory.limit reports or increases the limit in force on the total allocation.

Usage

memory.size(max = FALSE)

memory.limit(size = NA)

Arguments

max

logical. If TRUE the maximum amount of memory obtained from the OS is reported, if FALSE the amount currently in use, if NA the memory limit.

size

numeric. If NA report the memory limit, otherwise request a new limit, in Mb. Only values of up to 4095 are allowed on 32-bit R builds, but see ‘Details’.

Details

Command-line flag --max-mem-size sets the maximum value of obtainable memory (including a very small amount of housekeeping overhead). This cannot exceed 3Gb on 32-bit Windows, and most versions are limited to 2Gb. The minimum is currently 32Mb.

If 32-bit R is run on most 64-bit versions of Windows the maximum value of obtainable memory is just under 4Gb. For a 64-bit versions of R under 64-bit Windows the limit is currently 8Tb.

Memory limits can only be increased.

Environment variable R_MAX_MEM_SIZE provides another way to specify the initial limit.

Value

Size in Mb (1048576 bytes), rounded to 0.01 Mb for memory.size and rounded down for memory.limit.

See Also

Memory-limits for other limits.

The rw-FAQ for more details and references.

Examples

memory.size()
memory.size(TRUE)
memory.limit()


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM