zoukankan      html  css  js  c++  java
  • 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()
    
    还记得有一个人在前面
  • 相关阅读:
    NOIP2014D2T2寻找道路(Spfa)
    【割点】【割边】tarjan
    NOIP2013D1T3货车运输(最大生成树+倍增lca)
    lca最近公共祖先(模板)
    人生第一次hash
    【模板】Tarjan求强连通分量
    【模板】链式前向星+spfa
    二叉树的三种遍历
    hdu 3549 最大流
    hdu 1532&&poj1273 基础最大流
  • 原文地址:https://www.cnblogs.com/zhaoyang10/p/4285702.html
Copyright © 2011-2022 走看看