When f
is called a stack of 5 levels is built down to show.large.objects
, which starts to evaluate the contents of the frames starting from the top.
f
-> print
-> system.time
-> show.large.objects.stack
-> show.large.objects
Level 1
f()
Everything ok here.
Level 2
print(system.time(show.large.objects.stack()))
When you call ls(.envir, all.names)
on its frame you get
[1] "..." "x"
of which ...
is missing and throws error 3 when you call get
on it, and x = system.time(show.large.objects.stack())
is currently being evaluated and throws error 4.
Level 3
system.time(show.large.objects.stack())
whose ls
gives you
[1] "expr" "gcFirst" "ppt" "time"
of which expr = show.large.objects.stack()
is still currently being evaluated and throws another of error 4.
Level 4
show.large.objects.stack()
whose ls
contain no sketchy things and completes without errors.
Bottom line
show.large.frames()
must be evalutad on its own, not as an argument to any function, or it will throw errors. Why not letting it do the printing itself?
I found this very helpful
> debug(show.large.objects)
> f()
Browse[2]> lapply(sys.frames(), ls)
[[1]]
[1] "c" "d"
[[2]]
[1] "x"
[[3]]
[1] "expr" "gcFirst" "ppt" "time"
[[4]]
[1] "level" "skip.levels"
[[5]]
[1] "exclude" "threshold"