similar to: Ctrl-C of functions that allocated mem

Displaying 20 results from an estimated 20000 matches similar to: "Ctrl-C of functions that allocated mem"

2012 Mar 18
2
malloc/calloc/strdup and R's aequivalents
Hello, when looking at "Writing R Extensions" with mem-allocation in mind, I wondered, which functions to use to substitute malloc(), calloc(), realloc() and strdup() and free(). It looked like Calloc() or R_Calloc() might be useful for some of my tasks, but when trying to use R_Calloc() for example, I got some error messages which I don't see where they are coming from. Maybe I
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
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
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
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
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.
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.
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
2004 Jun 14
5
mkChar can be interrupted
Hi, As was discussed earlier in another thread and as documented in R-exts .Call() should not be interruptible by Ctrl-C. However the following code, which spends most of its time inside mkChar, turned out to be interruptible on RH-7.3 R-1.8.1 gcc-2.96: #include <Rinternals.h> #include <R.h> SEXP foo0(const SEXP nSexp) { int i, n; SEXP resSexp; if (!isInteger(nSexp))
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 Apr 14
1
clean-up actions after non-local exits
Dear R-devel, Some time ago I started a thread that boiled down to clean-up actions after non-local exits in R, see below. I wonder if there has been any progress on this? R-ext 2.6.1 doesn't say much on the subject. How, for example, do people deal with a situation where their C (C++) function opens a file and then receives a signal or longjump-s on error(), how do they make sure the
2001 Jan 05
1
segfault when calling C code
Hi, all. I've got some C code that I've used successfully, and fairly extensively, in R-1.1.1, which is suddenly causing segmentation faults in R-1.2.0. The original code used calloc (just plain calloc) with a free at the end, but I've tried replacing the calloc with R_alloc (based on the Writing R extensions documentation, which I'm not sure I've understood properly), and
2000 Sep 07
1
Calloc() & Free() in different .C(.) calls --> not usable ?
[sending this to R-devel, since it may be of general interest and could possibly lead to better instructions in the "R-exts" manual] Is this another case where only .Call() or .External() [or a fudge factor] solve my problem? Following situation: I use dyn.loaded C code to compute a recursive tree structure from my data. Beforehand I don't know how big the tree will
2009 Dec 28
2
[BioC] make.cdf.package: Error: cannot allocate vector of size 1 Kb
My machine has 8GB memory. I had quit all other programs that might take a lot of memory when I try the script (before I post the first message in this thread). The cdf file is of only 741 MB. It is strange to me to see the error. On Mon, Dec 28, 2009 at 2:38 AM, Wolfgang Huber <whuber at embl.de> wrote: > Dear Peng Yu > > how big is the RAM of your computer? You could try with
2012 Dec 07
1
memory management in C code
Hi , I am a newbie to R and i am trying to create a R package which is pretty main memory intensive. I would like to know what happens to the variables allocated in the C code while writing R extensions based on C. Are they preserved until someone de-allocate them or are they taken out by R's garbage collection ? Thanks Vineeth [[alternative HTML version deleted]]
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
2007 Sep 13
1
chartr better
For example, the following changes are necessary when i convert a Japanese hiragana into katakana in chattr. R code: > chartr("\u3041-\u3093","\u30a1-\u30f3","\u3084\u3063\u305f\u30fc") --- R-alpha.orig/src/main/character.c 2007-09-05 07:13:27.000000000 +0900 +++ R-alpha/src/main/character.c 2007-09-13 16:10:21.000000000 +0900 @@ -2041,6 +2041,16 @@
2001 Oct 05
1
modifying matrix allocation functions for use with R
Dear R people, I'm using compiled C code as a shared library as a backend to C code, using the .C interface. I need to do some matrix manipulation in the C code. I decided to use the new GSL (Gnu Scientific Library) currently (0.9.3) in beta status. This has appropriate matrix structures defined, and quite a comprehensive collection of matrix routines. However, there is a problem with the
2008 Apr 11
1
R_alloc vs. malloc
Dear list I have two (trivial) memory-questions related to a call with .C: If I allocate memory with R_alloc in a C-program (called with .C), will that memory "be taken from" the "available memory pool" (of a maximum of 4gb?) which R can allocate? (This is the impression I get from "Writing R extensions".) If instead I use malloc; will that memory then be taken
2014 Sep 19
1
Pointer ownership with GECreateDevDesc/GEDestroyDevDesc
According to the "R Internals" document, for a custom device, I should create a pDevDesc structure that gets passed to GECreateDevDesc. ..elided... pDevDesc dev; /* Allocate and initialize the device driver data */ if (!(dev = (pDevDesc) calloc(1, sizeof(DevDesc)))) return 0; /* or error() */ /* set up device driver or free ?dev? and error() */ gdd = GEcreateDevDesc(dev);