Displaying 20 results from an estimated 10000 matches similar to: "memory allocation problem under linux"
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
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.
2010 Apr 19
1
transient memory allocation and external pointers
Hello,
The Writing R extensions manual section 6.1.1 describes the transient
memory allocation function R_alloc, and states that memory allocated
by R_alloc is automatically freed after the .C or .Call function is
completed. However, based on my understanding of R's memory handling,
as well as some test functions I have written, I suspect that this is
not quite accurate. If the .Call
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
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
2003 Dec 05
3
.C() memory allocation
I would like to retrieve a vector of integers from a call to .C(), but I
don't know its length in advance. How do I do this without making an ugly
safe guess?
My vector is called "sequences".
I am passing the argument sequences = integer(0) in the call to .C(),
then declaring the corresponding argument as int *sequences in my C code.
I tried R_alloc()ing the storage in C and
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
2017 Oct 18
1
uniform sampling without replacement algorithm
> From: "Pavel S. Ruzankin" <ruzankin at math.nsc.ru>
> Let us consider the current uniform sampling without replacement
> algorithm. It resides in function do_sample in
> https://svn.r-project.org/R/trunk/src/main/random.c
> Its complexity is obviously O(n), where the sample is selected from
> 1...n, since the algorithm has to create a vector of length n. So
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
2017 Jun 04
1
nmax parameter in factor function
I'll go just a bit "fer-er." It appears the anomaly -- I hesitate to
call it a bug -- is in the C code for duplicated.default():
> duplicated(letters[1:10],nmax=10)
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> duplicated(letters[1:10],nmax=9)
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> duplicated(letters[1:10],nmax=8) ## for
2017 Jun 04
0
nmax parameter in factor function
Well, you won't like this, but it is kind of wimpily (is that a word?)
documented:
If you check the code of factor(), you will see that nmax appears as
an argument in a call to unique(). ?unique says for nmax, "... see
duplicated" . And ?duplicated says:
"If nmax is set too small there is liable to be an error: nmax = 1 is
silently ignored."
So sometimes you get an error
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
2017 Jun 04
2
nmax parameter in factor function
I have been trying to understand how the argument 'nmax' works in
'factor' function. R-Documentation states - "Since factors typically
have quite a small number of levels, for large vectors x it is helpful
to supply nmax as an upper bound on the number of unique values."
In the code below what is the reason for error when value of nmax is
24. Why did the same error not
2004 Dec 30
1
optim/vmmin and R_alloc
I am calling 'vmmin' several times from a C function (which is called via
.C). It works very well, except for memory consumption. The cause is that
vmmin allocates memory via R_alloc, and this memory is not freed as vmmin
exits. Instead all the allocated memory is freed on return of the .C
call.
In one application, I have 2000 functions of 500 variables each to
minimize. In each call to
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]
2010 Jun 18
3
Use of .Fortran
I have no experience with incorporating Fortran code and am probably
doing something pretty stupid.
I want to use the following Fortran subroutine (not written by me) in
the file SSFcoef.f
subroutine SSFcoef(nmax,nu,A,nrowA,ncolA)
implicit double precision(a-h,o-z)
implicit integer (i-n)
integer l,i,nmax
double precision nu,A(0:nmax,0:nmax)
A(0,0) =
2010 Jun 18
3
Use of .Fortran
I have no experience with incorporating Fortran code and am probably
doing something pretty stupid.
I want to use the following Fortran subroutine (not written by me) in
the file SSFcoef.f
subroutine SSFcoef(nmax,nu,A,nrowA,ncolA)
implicit double precision(a-h,o-z)
implicit integer (i-n)
integer l,i,nmax
double precision nu,A(0:nmax,0:nmax)
A(0,0) =
2004 Sep 14
3
memory allocation questions
Dear R-devel
This one seems a bit arcane for R-help. I very often use R to call routines written in Delphi (son of Pascal), doing "persistent" memory allocation within Delphi. That is, I start R and load the Delphi DLL; then I use .C to call a Delphi routine which allocates a piece of memory X and returns to R a pointer to X; then I do some more stuff in R; then I call another Delphi