The goal of procmaps is to help determine which library or other region is mapped to a specific address of a process.
It is the equivalent of /proc/self/maps as a data frame, and is designed to work on all major platforms.
You can install the released version of procmaps from CRAN with:
install.packages("procmaps")
And the development version from GitHub with:
# install.packages("pak")
pak::pak("r-prof/procmaps")
This is what the kernel exposes for this R process on Linux, truncated to its first few regions:
cat(readLines("/proc/self/maps"), sep = "\n")
56105b1c9000-56105b1ca000 r--p 00000000 fe:00 549660 /opt/R/4.5.3/lib/R/bin/exec/R
56105b1ca000-56105b1cb000 r-xp 00001000 fe:00 549660 /opt/R/4.5.3/lib/R/bin/exec/R
56105b1cb000-56105b1cc000 r--p 00002000 fe:00 549660 /opt/R/4.5.3/lib/R/bin/exec/R
56105b1cc000-56105b1cd000 r--p 00002000 fe:00 549660 /opt/R/4.5.3/lib/R/bin/exec/R
56105b1cd000-56105b1ce000 rw-p 00003000 fe:00 549660 /opt/R/4.5.3/lib/R/bin/exec/R
561096d4b000-56109b491000 rw-p 00000000 00:00 0 [heap]
7fbd563f2000-7fbd5641c000 r--p 00000000 fe:00 1696201 /root/R/x86_64-pc-linux-gnu-library/4.5/testthat/libs/testthat.so
7fbd5641c000-7fbd5645c000 r-xp 0002a000 fe:00 1696201 /root/R/x86_64-pc-linux-gnu-library/4.5/testthat/libs/testthat.so
7fbd5645c000-7fbd5646f000 r--p 0006a000 fe:00 1696201 /root/R/x86_64-pc-linux-gnu-library/4.5/testthat/libs/testthat.so
7fbd5646f000-7fbd56473000 r--p 0007c000 fe:00 1696201 /root/R/x86_64-pc-linux-gnu-library/4.5/testthat/libs/testthat.so
7fbd56473000-7fbd56475000 rw-p 00080000 fe:00 1696201 /root/R/x86_64-pc-linux-gnu-library/4.5/testthat/libs/testthat.so
7fbd56475000-7fbd5647d000 rw-p 00000000 00:00 0
Other operating systems make this information available in other form. This package provides the equivalent as a data frame, regardless of operating system:
library(procmaps)
procmap_get(as_tibble = TRUE)
#> # A tibble: 530 × 6
#> from to perms offset inode pathname
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 000056105b1c9000 000056105b1ca000 r--p 00000000 549660 /opt/R/4.5.3/lib/R/…
#> 2 000056105b1ca000 000056105b1cb000 r-xp 00001000 549660 /opt/R/4.5.3/lib/R/…
#> 3 000056105b1cb000 000056105b1cc000 r--p 00002000 549660 /opt/R/4.5.3/lib/R/…
#> 4 000056105b1cc000 000056105b1cd000 r--p 00002000 549660 /opt/R/4.5.3/lib/R/…
#> 5 000056105b1cd000 000056105b1ce000 rw-p 00003000 549660 /opt/R/4.5.3/lib/R/…
#> 6 0000561096d4b000 000056109b6f2000 rw-p 00000000 0 [heap]
#> 7 00007fbd563f2000 00007fbd5641c000 r--p 00000000 1696201 /root/R/x86_64-pc-l…
#> 8 00007fbd5641c000 00007fbd5645c000 r-xp 0002a000 1696201 /root/R/x86_64-pc-l…
#> 9 00007fbd5645c000 00007fbd5646f000 r--p 0006a000 1696201 /root/R/x86_64-pc-l…
#> 10 00007fbd5646f000 00007fbd56473000 r--p 0007c000 1696201 /root/R/x86_64-pc-l…
#> # ℹ 520 more rows
Both outputs above are recordings of the same R process, taken on x86_64 Linux under R 4.5.3 and replayed from README-fixtures/,
so the addresses in the two views correspond.
The one exception is [heap], which ends higher in the second view,
because procmap_get() allocates between the two snapshots and the heap grows.
A live run would differ on every render, because the addresses are randomised and the mapped regions depend on the machine.
Please note that the procmaps project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.