R
's default configuration options disable memory profiling, shared-library libR
, static-library libR.a
, GNU
gettext
, valgrind
headers, and link-time optimisation.
Some of these (like valgrind
) must just be because not everyone will use it. Others might be answered elsewhere on SO (like Is there any reason why not to use link time optimization? might answer --enable-lto[=no]
).
But what is the possible disadvantage or cost of enabling memory profiling in R
?
Specifically, the Memory Profiler can show you the following about object allocations: What types of objects were allocated and how much space they use. The stack trace of each allocation, including in which thread. When the objects were deallocated (only when using a device with Android 8.0 or higher).
The easiest way to profile a single method or function is the open source memory-profiler package. It's similar to line_profiler , which I've written about before . You can use it by putting the @profile decorator around any function or method and running python -m memory_profiler myscript.
Oops, apparently the answer can be found from https://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rprofmem.html:
The memory profiler slows down
R
even when not in use, and so is a compile-time option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With