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)

