Rprofmem                package:utils                R Documentation

_E_n_a_b_l_e _P_r_o_f_i_l_i_n_g _o_f _R'_s _M_e_m_o_r_y _U_s_e

_D_e_s_c_r_i_p_t_i_o_n:

     Enable or disable reporting of memory allocation in R.

_U_s_a_g_e:

     Rprofmem(filename = "Rprofmem.out", append = FALSE, threshold = 0)

_A_r_g_u_m_e_n_t_s:

filename: The file to be used for recording the memory allocations. Set
          to 'NULL' or '""' to disable reporting. 

  append: logical: should the file be over-written or appended to? 

threshold: numeric: allocations on R's "large vector" heap larger than
          this number of bytes will be reported. 

_D_e_t_a_i_l_s:

     Enabling profiling automatically disables any existing profiling
     to another or the same file.

     Profiling writes the call stack to the specified file every time
     'malloc' is called to allocate a large vector object or to
     allocate a page of memory for small objects. The size of a page of
     memory and the size above which 'malloc' is used for vectors are
     compile-time constants, by default 2000 and 128 bytes
     respectively.

     The profiler tracks allocations, some of which will be to
     previously used memory and will not increase the total memory use
     of R.

_V_a_l_u_e:

     None

_N_o_t_e:

     The memory profiler slows down R even when not in use, and so is a
     compile-time option.  The memory profiler can be used at the same
     time as other R and C profilers.

_S_e_e _A_l_s_o:

     The R sampling profiler, 'Rprof' also collects memory information.

     'tracemem' traces duplications of specific objects.

     The "Writing R Extensions" manual section on "Tidying and
     profiling R code"

_E_x_a_m_p_l_e_s:

     ## Not run: 
     ## not supported unless R is compiled to support it.
     Rprofmem("Rprofmem.out", threshold=1000)
     example(glm)
     Rprofmem(NULL)
     noquote(readLines("Rprofmem.out", n=5))
     ## End(Not run)

