similar to: Finalizer execution order question

Displaying 20 results from an estimated 1000 matches similar to: "Finalizer execution order question"

2020 Apr 03
4
The finalizer of the externalPtr does not work when closing R?
Hi all, I found that the finalizer of the externalPtr is not called when R is quitting. However, manually calling GC() works fine. This behavior is observed on devel R 2020-04-02 r78142 on Win and R 3.6.3 on Ubuntu. I make a reproducible package here: https://github.com/Jiefei-Wang/example Here is the detail of how to reproduce the problem, I create a temporary file in the package root path and
2012 Oct 02
1
ffsave problems
Dear R friends. After having some troubles learning how to create a ffdf object, now I find myself having problems saving it. this is the data i´d like to save: str(DATA) List of 3 $ virtual: 'data.frame': 6 obs. of 7 variables: .. $ VirtualVmode : chr "double" "short" "integer" "integer" ... .. $ AsIs : logi FALSE FALSE FALSE
2020 Apr 03
0
The finalizer of the externalPtr does not work when closing R?
See R_RegisterCFinalizerEx() and set onexit to nonzero. Here: https://github.com/wch/r-source/blob/9353ddfa8d30069ad8975e0364307d710f2488d5/src/include/Rinternals.h#L1279-L1280 Gabor On Fri, Apr 3, 2020 at 1:56 PM Wang Jiefei <szwjf08 at gmail.com> wrote: > > Hi all, > > I found that the finalizer of the externalPtr is not called when R is > quitting. However, manually
2020 Apr 03
0
[External] The finalizer of the externalPtr does not work when closing R?
Use R_RegisterFinalizerEx in your C code. See https://cran.r-project.org/doc/manuals/r-release/R-exts.html#External-pointers-and-weak-references This still gives you only "best effort"; for anything stronger you would need a different approach. In general, finalizers should only be used as a backstop, not as a primary resource management tool (in R or any other garbage-collected
2005 Jul 26
1
Error registering finalizer
What exactly is a reference object? I'm getting this error message attempting to register a finalizer: can only weakly reference/finalize reference objects I don't see any problem with the code... Here's what appears to be the relevant portions. setClass("PDNNObject", representation(handle = "externalptr", id =
2008 Jan 29
2
Problem with new("externalptr")
Hi, It seems that new("externalptr") is always returning the same instance, and not a new one as one would expect from a call to new(). Of course this is hard to observe: > new("externalptr") <pointer: (nil)> > new("externalptr") <pointer: (nil)> since not a lot of details are displayed. For example, it's easy to see that 2
2011 Jul 23
2
xml2-config issues
I'm trying to install the XML package on Ubuntu 10.10, and I keep getting a warning message the XML could not be found and had non-zero exit status. How can I fix this problem? > install.packages() Loading Tcl/Tk interface ... done --- Please select a CRAN mirror for use in this session --- Installing package(s) into ‘/home/amathew/R/i686-pc-linux-gnu-library/2.13’ (as ‘lib’ is
2014 Oct 27
1
proper use of reg.finalizer to close connections
Hi all, I have a question about finalizers... I have a package that manages state for a few connections, and I'd like to ensure that these connections are 'cleanly' closed upon either (i) R quitting or (ii) an unloading of the package. So, in a pared-down example package with a single R file, it looks something like: ##### BEGIN PACKAGE CODE ##### .CONNS <- new.env(parent =
2012 Dec 25
2
reinterpreting externalptr in R
Hi, I am using swig to build a wrapper for an c-function to use it in R. I would like to define a generic function, which gives back a void pointer. On the R side, I know what this pointer is pointing to, whether it is an integer or an string, or something else... but I need to somehow reinterpret the resulting "externalptr" into another form... a function that looks like the
2011 Jul 22
1
reg.finalizer and connection gc -- which runs when (and why)?
With this set-up options(warn = 1) tf <- tempfile() finalizer <- function(obj) { message("finalizer") close(obj$f) } this code works ev <- new.env() ev$f <- file(tf, "w") reg.finalizer(ev, finalizer) rm(ev) gc() whereas this (reversing the order of file() and reg.finalizer()) ev <- new.env() reg.finalizer(ev, finalizer) ev$f <- file(tf,
2012 May 11
1
Passing externalptr to .C()
Greetings. 2.15.0 added this behavior http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2012/03/29#n2012-03-29 o Passing R objects other than atomic vectors, functions, lists and environments to .C() is now deprecated and will give a warning. Most cases (especially NULL) are actually coding errors. NULL will be disallowed in future. This seems to make sense,
2011 Oct 13
1
Package snow: is there any way to check if a cluster is "acticve"
Is there a 'proper' way of checking if cluster is active. For example, I create a cluster called .PBcluster > str(.PBcluster) List of 4 $ :List of 3 ..$ con :Classes 'sockconn', 'connection' atomic [1:1] 3 .. .. ..- attr(*, "conn_id")=<externalptr> ..$ host: chr "localhost" ..$ rank: int 1 ..- attr(*, "class")= chr
2018 Mar 18
3
`@<-` modify its argument when slot is externalptr
Dear all, I am confused about the inconsistent behaviors of `@<-` operator when used in different ways. Consider the following example: library(inline) # Function to generate an externalptr object with random address new_extptr <- cfunction(c(), ' SEXP val = PROTECT(ScalarLogical(1)); SEXP out = PROTECT(R_MakeExternalPtr(&val, R_NilValue, val)); UNPROTECT(2);
2009 Oct 27
1
Rjava, RImageJ, and/or S4 question.
I am out of my league with this question. The following code starts the java imaging program ImageJ from within R, and displays an image (assuming ImageJ is installed on your computer). library(RImageJ) img <- IJ$openImage( file.choose() ) #pick an available .tif file img$show() # make the image object visible # An image is now displayed # find out about the objects involved >
2011 Apr 02
0
reg.finalizer(): Multiple finalizers?
Hi, I've got some questions regarding finalizers registered using reg.finalizer(). I have a setup where in certain cases I wish to set a new finalizer to an object that already got one. Since there is no API for removing/replacing already registered finalizers (have been "requested" previously on this list), I have basically just added a new finalizer by calling reg.finalizer() a
2013 Feb 13
2
stopping finalizers
Is there some way to prevent finalizers running during a section of code? I have a package that includes R objects linked to database tables. To maintain the call-by-value semantics, tables are copied rather than modified, and the extra tables are removed by finalizers during garbage collection. However, if the garbage collection occurs in the middle of processing another SQL query (which is
2016 May 14
2
R external pointer and GPU memory leak problem
My question is based on a project I have partially done, but there is still something I'm not clear. My goal is to create a R package contains GPU functions (some are from Nividia cuda library, some are my self-defined CUDA functions) My design is quite different from current R's GPU package, I want to create a R object (external pointer) point to GPU address, and run my GPU function
2019 Jun 08
2
Determining the exit code of an "almost finished" R script
On Sat, Jun 8, 2019 at 2:13 PM Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > > On 08/06/2019 7:42 a.m., Gergely Dar?czi wrote: > > Dear All, > > > > I'm using "reg.finalizer" in a function that is to be called in R scripts > > to do some cleanup on success. I have not found a way to run the function > > only if the script run without
2001 Jul 10
1
Object finalization
I see some code in R to attach finalizers to external pointer references (Register[C]Finalizer). Anyone have an example of how to code the finalizer? R_RegisterCFinalizer accepts a C function, but I can't see how to get it to operate on the pointer, since the pointer is not passed to the function when its called. RegisterFinalizer takes an R closure, but how is it called from R (tried
2016 Aug 06
1
vector finalizers
Dear R Devel, In a thread this morning Luke Tierney mentioned that R's way of garbage collecting is going to change soon in 3.4.0. I couldn't find this info on Google but I wanted to share what I had been discussing in another forum, in case now is not too late to raise considerations which could affect the design of planned changes to R's garbage collection facilities. I ran into a