similar to: Limit on number of times Realloc can be called?

Displaying 20 results from an estimated 8000 matches similar to: "Limit on number of times Realloc can be called?"

2008 Mar 05
1
SEXP size management.
Hi, Trying to decrease the size of a SEXP variable without reassigning values individually in a loop. So far, I've tried using Realloc, as the follow source demonstrates: SEXP dothis() { SEXP Rblah; PROTECT(Rblah = NEW_INTEGER(6)); int* blah = INTEGER(Rblah); blah[0] = 1; blah[1] = 2; blah[2] = 3; Realloc(Rblah, 3, INTEGER); UNPROTECT(1); return(Rblah); } According to the
2019 Sep 13
1
[PATCH nbdkit] common/bitmap: Don't fail on realloc (ptr, 0)
The following commands: nbdkit -fv --filter=cow memory size=512 --run 'qemu-img info $nbd' nbdkit -fv --filter=cache memory size=512 --run 'qemu-img info $nbd' both fail with: nbdkit: memory[1]: error: realloc: Success Initial git bisect pointed to commit 3166d2bcbfd2 (but I don't believe that commit is the real cause, it merely exposes the bug). The reason this
2019 Sep 15
2
[PATCH nbdkit v2] common/bitmap: Don't fail on realloc (ptr, 0)
v1 was here: https://www.redhat.com/archives/libguestfs/2019-September/msg00100.html In v2 I've changed the patch so it avoids calling realloc at all in this case. The patch is a bit longer this way. But I don't see any other alternative if we are to avoid having a "realloc wrapper" of some kind that we use everywhere, which I guess we should avoid because it makes plugins
2010 Jun 15
1
Error when callin g C-Code
Hi when I call the function below in R, i get the error: Object 'pairlist' can't be converted to 'double'. #include <R.h> #include <Rdefines.h> #include <Rmath.h> SEXP CSimPoisson(SEXP lambda, SEXP tgrid, SEXP T2M, SEXP Ni, SEXP NT) { double sign, EVar; double *xlambda, *xtgrid, *xT2M, *xNi, *xNT, *xtau; SEXP tau; int ltgrid =0; int i = 0; int j = 0;
2008 Dec 19
2
Using realloc to remove MAX_LISTEN_SOCKS limit on sshd.c
OpenSSH developers, I have removed the fixed, arbitrary limit on the number of ListenAddress allowed by using realloc to dynamically expand listen_socks as needed. This completely removes MAX_LISTEN_SOCKS from the source. I made this change on the version of OpenSSH shipped with CentOS 5.2, version 4.3p2. Please see the attached .c file and .diff file. Please add these changes to OpenSSH
2017 Feb 25
3
[Bug 2684] New: calling realloc with a size <= 0
https://bugzilla.mindrot.org/show_bug.cgi?id=2684 Bug ID: 2684 Summary: calling realloc with a size <= 0 Product: Portable OpenSSH Version: -current Hardware: amd64 OS: FreeBSD Status: NEW Severity: normal Priority: P5 Component: Miscellaneous Assignee: unassigned-bugs at
2009 Oct 23
1
Confusion regarding allocating Matrices.
Hi I'm having slight confusion. I plan to grow/realloc a matrix depending on the data available in a C program. Here is what I'm tried to do: Data=allocMatrix(REALSXP,3,4); SEXP Data; REAL(Data)[8]=0.001123; REAL(Data)[200000]=0.001125; printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[200000]); Here is my confusion: Do I always require to allocate the exact number of data
2006 Nov 21
1
1.2beta1 speex_bits_pack realloc issue?
In bits.c\speex_bits_pack there is logic to reallocate the bits buffer. In that section there is a call to speex_memset_bytes which appears to wipe out all the old bytes. I found when I encoded a multi-frame message that needed less than the default 2000 bytes for bits->chars, everything worked fine. However, when I encoded a longer message that triggered the realloc code in speex_bits_pack,
2011 Jun 25
2
On .. glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next size: 0x000000000209e210 ***
Hello, I'm trying to use rjson to parse a JSON object. The object can be found here http://pastebin.com/np0s5hgM (you'll probably need to add quotes around the content) fromJSON returns the error glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next size: 0x000000000209e210 *** Is there a fix coming soon? Maybe CRAN should also have an outstanding bug field -
2003 Oct 03
1
allocating memory in a C module
Hi, I'm using a package that has a number of formats. I have C code to parse these formats the results of which are generally integer arrays. I would like to utilize these modules in R rather than writing R code to read in these files (and also to learn about R extensions). Essentially what I want is to do something like this: load_tsets <- function(t,c,p) .C( "c_load_tsets",
2010 Oct 06
1
C code called from R: reallocate arrays passed as arguments?
Hello, I used to use a (somehow complicated) code in C and I have tried to adapt it to be called from R without making an excessive amount of changes. I am afraid I cannot post the code here, but I am going to try to describe the problem as accurately as possible. I have some arguments that are most of the cases required for internal C operations only; but as they are needed a few times as
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
2017 Apr 11
5
Potential issue with noalias @malloc and @realloc
Hi all, I think I've spotted a semantic issue with marking @malloc and @realloc as noalias.  Say we have the program: int f() {   int* p0 = malloc(size of(int));   free(p0);   int* p1 = malloc(sizeof(int));   if (!p1) return 20;   int value = 0;   for (int i = 0; i < 1; i++) {     *p1 = 20;     value = *p1;     if (false)  // "false" is obscured in a way the compiler can't
2018 Jul 20
1
[PATCH 2/2] Fix safe_realloc_add_2op_() to free memory when reallocation fails
--- include/share/alloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/share/alloc.h b/include/share/alloc.h index 914de9ba..63878db0 100644 --- a/include/share/alloc.h +++ b/include/share/alloc.h @@ -168,7 +168,7 @@ static inline void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2) free(ptr); return 0; } - return realloc(ptr, size2); + return
2007 Oct 18
3
append/concatenate an element to a list in C-language
dear people, i need to code a function in C working in R and receives two R SEXP objects as parameters, where one is a list and another is a vector of integers: void f(SEXP list, SEXP vector) { ... return list; } and it should return the given list with the integer vector concatenated at the end (as the last element of the list). the list can be really big so i would not like to create a
2018 Apr 30
0
[PATCH 3/4] common/qemuopts: use the old pointer as realloc pointer
Call realloc() directly with the pointer to the old data, instead of assigning it to the destination variable, and using that one. The rest of the code is the same, already properly checking for the results of realloc(), so this mostly help static code analyzers. --- common/qemuopts/qemuopts.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/qemuopts/qemuopts.c
2003 Dec 12
3
C++: Appending Values onto an R-Vector.
Hi folks. I posted this question a few days ago, but maybe it got lost because of the code I included with it. I'm having a problem using the SET_LENGTH() macro in an R extension I'm writing in C++. In a function within the extension I use SET_LENGTH() to resize R vectors so as to allow the concatenation of single values onto the vectors -- it's a "push back" function to
2006 Jan 14
0
com32's realloc function
Hello list, I've been playing with com32 programs lately and I've come across a a problem with the realloc function in libcom32. The code that rounds up the size looks to be missing a '~' operator, resulting in it truncating every request to a size of 0-15 bytes. The little patch below fixes it up to match the corresponding line in malloc, which makes it work for me. K. diff
2019 Sep 15
0
[PATCH nbdkit v2] common/bitmap: Don't fail on realloc (ptr, 0)
The following commands: nbdkit -fv --filter=cow memory size=512 --run 'qemu-img info $nbd' nbdkit -fv --filter=cache memory size=512 --run 'qemu-img info $nbd' nbdkit -fv --filter=cow null --run 'qemu-img info $nbd' all fail with: nbdkit: memory[1]: error: realloc: Success Initial git bisect pointed to commit 3166d2bcbfd2 (this is not real cause, it merely
2007 Jan 19
5
Problem with C extension
Hello, I try to write an extension in C, to get a faster functions. Therefore I have to add an element (vector) to a vector. The command in R is very simple: x = c(x,a) But in C I have the problem to reallocate my vector for getting more space. Everything I tried, I get a "Segmentation fault". So, how can I combine two vectors in C and give the result back to R (return(x))? Thanks