similar to: memory allocation problem under linux

Displaying 20 results from an estimated 6000 matches similar to: "memory allocation problem under linux"

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.
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
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
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
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
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
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) =
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 Oct 30
1
unique(1:3,nmax=1) freezes R
Dear all, I was playing around with factor contrasts, and found the argument nmax on function factor. When using nmax=1, R froze completely, and I had to close it from task manager. After some debugging, I found that the problem is actually in unique-function, where the internal unique function is called: .Internal(unique(x, incomparables, fromLast, nmax)) More generally, it looks like
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
2012 Nov 12
2
how to enter a string value
hi, I want to know just enter a string value entering a numeric value is make with the function scan () or scan (nmax = ..) but it does not work for string my goal is to enter three string: name and surname and date of birth I try with this code but it shows me errors print ("enter the name") name <- scan (nmax = 1) print ("enter the first name") firstName <- scan
2011 Mar 19
2
problem running a function
Dear people, I'm trying to do some analysis of a data using the models by Royle & Donazio in their fantastic book, particular the following function: http://www.mbr-pwrc.usgs.gov/pubanalysis/roylebook/panel4pt1.fn that applied to my data and in the console is as follows: > `desman.y` <- structure(c(3L,4L,3L,2L,1L), .Names = c("1", "2", "3",
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