File: zzz_finalizer_crash.R

package info (click to toggle)
r-cran-r.utils 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,936 kB
  • sloc: sh: 18; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This script crashes in ~40s on R 2.15.3 patched and R 3.0.2 with
# R.oo (< 1.18.0).  It only does so when 'methods' is attached.  It
# does not crash on R 3.0.2 patched (2014-02-21 r65057) and beyond.
# It appears to not crash with 'R CMD check' on 2.15.3 but if run
# via 'Rscript' or similar. /HB 2014-02-22
library("methods")
library("R.methodsS3")
loadNamespace("R.utils")

# Remove all existing variables
rm(list=ls(all.names=TRUE))
gc()

R.oo::setConstructorS3("Verbose2", function(con=stderr(), ...) {
  R.oo::extend(R.oo::Object(), "Verbose",
    .con = con
  )
})

print(sessionInfo())
message(Sys.time())
local({
  Verbose2(file())
  gctorture(TRUE)
  unloadNamespace("R.utils")
  unloadNamespace("R.oo")
  NULL
})
gctorture(FALSE)
message(Sys.time())
print(sessionInfo())