Displaying 20 results from an estimated 4000 matches similar to: "vector finalizers"
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 Sep 15
1
Finalizer execution order question
Given an externalptr object 'pool' which protects an R object 'prot':
# SEXP prot = (a dynamically updated list with handles)
SEXP pool = R_MakeExternalPtr(p, R_NilValue, prot);
R_RegisterCFinalizerEx(pool, fin_pool, TRUE);
WRE explains that 'prot' remains in existence as long as 'pool' is
around. Does this also mean 'prot' still exists when the
2017 Sep 04
1
Suggestion: Create On-Disk Dataframes
On 4 September 2017 at 11:35, Suzen, Mehmet wrote:
| It is not needed. There is a large community of developer using SparkR.
| https://spark.apache.org/docs/latest/sparkr.html
| It does exactly what you want.
I hope you are not going to mail a sparkr commercial to this list every day.
As the count is now at two, this may be an excellent good time to stop it.
Dirk
--
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
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,
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
2015 Nov 23
4
Custom C finalizers for .Call
WRE explains that R_alloc() can be used to allocate memory which
automatically gets released by R at the end of a .C, .Call or
.External, even in the case of an error or interruption. This is a
really great feature to prevent memory leaks. I was wondering if there
is a way to extend this mechanism to allow for automatically running
UNPROTECT and custom finalizers at the end of a .Call as well.
2018 Mar 27
2
Objects not gc'ed due to caching (?) in R's S3 dispatch mechanism
I have committed a change to R-devel that addresses this. To be on the
safe side I need to run some more extensive tests before deciding if
this can be ported to the release branch for R 3.5.0. Should know in a
day or two.
Best,
luke
On Tue, 27 Mar 2018, luke-tierney at uiowa.edu wrote:
> This has nothing to do with printing or dispatch per se. It is the
> result of an internal register
2018 Aug 09
2
SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp
Thanks, Tomas, Luke, for the clarifications. Then, I have another question.
But first, let me introduce how I ended up here, because obviously I
just don't go around dyn.unloading things that I've just compiled. I
was testing a package with valgrind. Everything ok, no leaks. Great.
But I'm always suspicious (probably unjustifiably) of all the memory
that is reported as "still
2018 Mar 26
4
Objects not gc'ed due to caching (?) in R's S3 dispatch mechanism
Hi,
I initially opened an issue in the R6 repo because my issue was with
an R6 object. But Winston (thanks!) further simplified my example, and
it turns out that the issue (whether a feature or a bug is yet to be
seen) had to do with S3 dispatching.
The following example, by Winston, depicts the issue:
print.foo <- function(x, ...) {
cat("print.foo called\n")
invisible(x)
}
2018 Mar 27
2
Objects not gc'ed due to caching (?) in R's S3 dispatch mechanism
2018-03-27 6:02 GMT+02:00 <luke-tierney at uiowa.edu>:
> This has nothing to do with printing or dispatch per se. It is the
> result of an internal register (R_ReturnedValue) being protected. It
> gets rewritten whenever there is a jump, e.g. by an explicit return
> call. So a simplified example is
>
> new_foo <- function() {
> e <- new.env()
>
2012 Oct 01
3
ffbase, help with %in%
Hello to everyone.
I'm trying to use the %in% to match to vectors in ff format.
a<-as.ff(data[,1]) %in% fire$fecha
> aff (open) logical length=3653 (3653)
[1] [2] [3] [4] [5] [6] [7] [8] [3646]
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE : FALSE
[3647] [3648] [3649] [3650] [3651] [3652] [3653]
FALSE FALSE FALSE FALSE FALSE FALSE
2018 Mar 27
1
Objects not gc'ed due to caching (?) in R's S3 dispatch mechanism
2018-03-27 11:11 GMT+02:00 Tomas Kalibera <tomas.kalibera at gmail.com>:
> On 03/27/2018 09:51 AM, I?aki ?car wrote:
>>
>> 2018-03-27 6:02 GMT+02:00 <luke-tierney at uiowa.edu>:
>>>
>>> This has nothing to do with printing or dispatch per se. It is the
>>> result of an internal register (R_ReturnedValue) being protected. It
>>> gets
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
2007 Aug 03
2
How to properly finalize external pointers?
Dear R .Call() insiders,
Can someone enlighten me how to properly finalize external pointers in C code (R-2.5.1 win)? What is the relation between R_ClearExternalPtr and the finalizer set in R_RegisterCFinalizer?
I succeeded registering a finalizer that works when an R object containing an external pointer is garbage collected. However, I have some difficulties figuring out how to do that in an
2001 Mar 04
1
passing pointer types via .C calls
Hi,
this relates to my earlier message about external references and
finalizers. I was experimenting over the weekend and now suspect that
the appropriate solution to my problem will be to have a special case in
the code that handles the .C call so that external references are
handled appropriately - I guess that a pointer to the reference should
be passed to the C code. As I've never
2006 Feb 20
0
Object Finalizers help
Heya guys,
This one is bothering me as its evading my eye. I''m trying to set a
callback on finalization of an object, ie: a finalizer set through a
plugin to the model.
Example In Plugin:
def acts_as_goat
class_eval do
ObjectSpace.define_finalizer(self, Proc.new {self.conn.close} )
end
end
class UberGoat < ActiveRecord::Base
acts_as_goat
end
Anyways, it seems to not
2015 Nov 25
0
Custom C finalizers for .Call
Jeroen,
I agree that it may be useful to have some kind of "finally"-like infrastructure. However, in the use cases you list there are already ways to do that - the same way that R_alloc uses. First, you don't need to call UNPROTECT - the whole point is that the protection stack is automatically popped in case of an abnormal termination. That is precisely how memory leaks are
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 =
2002 Mar 15
1
--diff option for rsync (Re: rsync feature request)
On 14 Mar 2002, david.e.sewell@jpmorgan.com wrote:
> I'm sure you get a million and one requests for changes to rsync. I thought
> I would put my bid in and sugest that a feature to perform a unix style
> diff of files that are found to be different would be useful for
> administrators that use rsync to maintain synchronised of application
> distributions. We us it to maintain