Displaying 20 results from an estimated 4000 matches similar to: "transient memory allocation and external pointers"
2010 Sep 08
1
winbuilder warnings and errors
Hello,
I have been developing a package for phylogenetic analysis which I
plan to submit to CRAN soon. It passes R CMD check with no warnings
on my linux and Mac OS X machines. I don't have much experience with
Windows and have been using the win-builder service to see how the
package compiles on Windows. (Thank you for this service, Uwe, it is
a huge time saver for me!)
I have tried
2005 Jun 13
1
memory allocation problem under linux
I have some compiled code that works under winXp but not under linux (kernel
2.6.10-5). I'm also using R 2.1.0
After debugging, I've discovered that in this code:
#define NMAX 256
long **box;
...
box = (long **)R_alloc(NMAX, sizeof(long *)); //<---HERE THE SIGSEGV
for (i=0; i<NMAX; i++) box[i] = (long *) R_alloc(NMAX, sizeof(long));
inside the *first* call to the
2005 Jun 12
1
memory allocation problem under linux
I have some compiled code that works under winXp but not under linux (kernel
2.6.10-5). I'm also using R 2.1.0
After debugging, I've discovered that this code:
#define NMAX 256
long **box;
...
box = (long **)R_alloc(NMAX, sizeof(long *));
gives a null pointer, so subsequent line:
for (i=0; i<NMAX; i++) box[i] = (long *) R_alloc(NMAX, sizeof(long));
gives a SIGSEGV signal.
2019 Feb 27
2
Intermittent crashes with inset `[<-` command
Valgrind (without gctorture) reports memory misuse:
% R --debugger=valgrind --debugger-args="--leak-check=full --num-callers=18"
...
> x <- 1:200000
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
+ # x[y == 'a'] <- x[y == 'b']
+ x <- `[<-`(x, y == 'a', x[y == 'b'])
+ cat(i, '')
+ }
1 2 3 4 5 6 7 8 9 10
2008 Jan 19
1
R_alloc segfaults
I want to write a little stand-alone C program that calls R_alloc, but
I get a segmentation fault:
int main(int argc, char** argv){
double* d = (double *)R_alloc(2, sizeof(double)); // <- segmentation fault!
return 0;
}
gdb reveals that sizeof(double) evaluated to 0:
> R_alloc (nelem=2, eltsize=0) at memory.c:1649
so it results in the segfault later.
This is how I compile my
2008 Aug 12
3
aligned memory allocation in C
Hi,
I'm currently R porting SF Mersenne Twister algorithm of Matsumoto and
Saito. To get the full power of their code, I want to use their
fonction fill_array32 which need aligned memory. That is to say I need
to use the C function memalign on windows, posix_memalign on linux and
classic malloc on Mac OS. In 'writing R extenstion', they recommand to
use R_alloc function to
2008 Aug 12
3
aligned memory allocation in C
Hi,
I'm currently R porting SF Mersenne Twister algorithm of Matsumoto and
Saito. To get the full power of their code, I want to use their
fonction fill_array32 which need aligned memory. That is to say I need
to use the C function memalign on windows, posix_memalign on linux and
classic malloc on Mac OS. In 'writing R extenstion', they recommand to
use R_alloc function to
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.
2008 Mar 05
1
R_alloc with structures with "flexible array members"
Dear All,
In a package, I want to use some C code where I am using a structure
(as the basic element of a linked list) with flexible array members.
Basically, this is a structure where the last component is an
incomplete array type (e.g., Harbison & Steel, "C, a reference
manual, 5th ed.", p. 159) such as:
struct Sequence {
struct Sequence *next;
int len;
unsigned int
2005 Mar 10
1
R_alloc with more than 2GB (PR#7721)
Full_Name: Wolfgang Huber
Version: R-devel_2005-03-10
OS: alphaev68-dec-osf4.0f
Submission from: (NULL) (62.253.128.15)
This report concerns allocation of large (>2^31 byte) chunks of memory with
R_alloc. I suspect it is a bug/typo but please don't hate me if it's actually a
feature:
In R, I can happily create large matrices:
> a= matrix(0, nrow=191481, ncol=3063)
> dim(a)
[1]
2004 Jun 11
1
memory allocation and interrupts
Hi,
A recent discussion on the list about tryCatch and signals made me think
about memory allocation and signals in C extension modules. What happens
to the memory allocated by R_alloc and Calloc if the user pressed Ctr-C
during the call? R-ext doesn't seem to discuss this. I'd guess that
R_alloc is interrupt-safe while Calloc is not, but I am not sure. In any
case a paragraph in R-ext
2011 Dec 21
1
When exactly do I need R_alloc when using the .Call() interface?
Hi,
I am trying to implement an algorithm in C which will be called via the
.Call() interface.
While reading the 'Writing R Extension' manual, I stumbled upon the
R_alloc() function for allocating storage for C objects. The manual says
it should be used to allocate storage if an C object is needed/created
while manipulating R objects within a function called via the .Call()
interface.
2013 Aug 27
1
Error in simulation. NAN
Hi all,
im triyng to implement a bayesian model with R and c++.
I have a strange problem. I can't reproduce the error with a small
script and then i post the original one.
The problem is after the line
for(MCMC_iter2=0;MCMC_iter2<thin;MCMC_iter2++)
For the first 34 iterations all work fine, after, all the simulations
of mu_acc_P return an "nan". If i delete the line
2009 Jul 20
3
S_alloc or Calloc for return value
I am trying to write a C function to create a vector of integers that can be
used by the R calling function. I do not know the size of the vector in the
R calling function. (Well, actually, I have an upper limit on the size, but
that is so large that R cannot allocate it. What I'm doing in the function
is to do a sieving procedure, and the result will be small enough to fit
into my
2005 Jul 19
2
R_AllocatePtr
Had been looking into Luke Tierney's R_AllocatePtr() and
was left with a question about exactly when does R reclaim
heap memory. Implication of 'simpleref.nw' is that one can
allocate C data on the R heap, and as long as pointer object
is alive, the data and pointer will remain valid. But it
calls allocString() which is implemented using R_alloc().
'Writing R Extensions" says
2012 May 04
4
[patch] Behavior of .C() and .Fortran() when given double(0) or integer(0).
Dear R-devel,
While tracking down some hard-to-reproduce bugs in a package I maintain,
I stumbled on a behavior change between R 2.15.0 and the current R-devel
(or SVN trunk).
In 2.15.0 and earlier, if you passed an 0-length vector of the right
mode (e.g., double(0) or integer(0)) as one of the arguments in a .C()
call with DUP=TRUE (the default), the C routine would be passed NULL
(the C
1998 Jan 21
2
alloc
I am trying to get our database interface (PADI) working with R. The code does
some memory allocation and for Splus there is an ifdef which controls whether
malloc or S_alloc is called. I did nm R.binary | grep alloc to see if this was
supported and I find there are some choices:
[2490] | 446036| 272|FUNC |GLOB |0 |7 |R_alloc
[806] | 693956| 312|FUNC |LOCL |0 |7
2004 Mar 02
1
passing a string from .C()
Hi,
Could someone please point to an example of passing strings from .C()
calls back to R? I want to be able to do something like this:
str <- .C("return_foo_string", str=character(1))$str
void return_foo_string(char ** str) {
*str = "foo";
}
The above code has at least two memory allocation "concerns":
1) How to properly allocate "foo". I
2006 Dec 04
2
Library file for the R engine in Windows?
Hi,
I am trying to use dynamic memory allocation in the C code to be called by R
through the .C interface.
I have used R_alloc as explained in the Writing R Extensions and included
the R.h header.
The program compiles fine but fails when linking. Obviously it needs a
library file where R_alloc is found.
I have tried to link by adding R.dll to list of files at the end of the link
command but
2006 Mar 15
1
R_alloc problem on Mac OSX (PR#8683)
Full_Name: Dan Kelley
Version: 2.2.1
OS: Mac OSX
Submission from: (NULL) (129.173.23.36)
I'm having difficulties getting R_alloc() to work on a 64-bit Mac running R
2.2.1 installed via a .dmg file obtained from the R site. Details are given
below, in a level of detail that I hope is appropriate. My eye was particularly
drawn to line #2 in the gdb 'where' output, but line #1 seems