Diff before and after snapshots

Usage,
mem_diff(before, after)

Arguments

before, after

Snapshots created by mem_snapshot() before and after an expression that causes a leak.

Value

after without the rows that exist in before. Note that the nodes in the node list-column still refer to nodes in before via parents, children, etc.

Examples

e <- new.env(parent = emptyenv())

e$x <- 1
before <- mem_snapshot(e)
#> Creating snapshot...
#> Computing dominance and retainment...
#> Creating data frame...

e$y <- 2
after <- mem_snapshot(e)
#> Creating snapshot...
#> Computing dominance and retainment...
#> Creating data frame...

# The snapshot diff only contains the bucket pairlist node where
# `y` is stored, the symbol `y`, and the double value `2` which is
# bound to `y`
mem_diff(before, after)
#> # A tibble: 3 × 8
#>   id        type   node   n_parents n_children n_retained retained_size gc_depth
#>   <chr>     <chr>  <list>     <int>      <int>      <int>     <bch:byt>    <int>
#> 1 0x565251… pairl… <mmtl…         1          2          2          168B        3
#> 2 0x56524e… symbol <mmtl…         1          0          0           56B        4
#> 3 0x565254… double <mmtl…         1          0          0           56B        4