Displaying 20 results from an estimated 20 matches for "r_allocstringbuffer".
2009 Mar 18
1
sprintf("%d", integer(0)) aborts
...------------------------
Index: sprintf.c
===================================================================
--- sprintf.c   (revision 48148)
+++ sprintf.c   (working copy)
@@ -79,13 +79,13 @@
     static R_StringBuffer outbuff = {NULL, 0, MAXELTSIZE};
     Rboolean use_UTF8;
-    outputString = R_AllocStringBuffer(0, &outbuff);
-
     /* grab the format string */
     nargs = length(args);
     format = CAR(args);
-    if (!isString(format) || length(format) == 0)
+    if (!isString(format))
        error(_("'fmt' is not a non-empty character vector"));
+    if (length(format) == 0)
+...
2007 Sep 13
1
chartr better
...e = WTR_INIT;
+        trs_cnt->next = NULL;
         trs_old = Calloc(1, struct wtr_spec);
         trs_old->type = WTR_INIT;
         trs_old->next = NULL;
@@ -2084,6 +2098,7 @@
         if(nc < 0) error(_("invalid multibyte string 'old'"));
         wc = (wchar_t *) R_AllocStringBuffer((nc+1)*sizeof(wchar_t), &cbuff);
         mbstowcs(wc, s, nc + 1);
+        wtr_build_spec(wc, trs_cnt); /* use count only */
         wtr_build_spec(wc, trs_old);
        s = translateChar(STRING_ELT(_new, 0));
@@ -2096,38 +2111,54 @@
         /* Initialize the pointers for walking through th...
2010 Jun 19
1
more powerful iconv
...;);
-	if(STRING_ELT(CADDDR(args), 0) == NA_STRING) sub = NULL;
+	if(STRING_ELT(CADDDR(args), 0) == NA_STRING || isRawx) sub = NULL;
 	else sub = translateChar(STRING_ELT(CADDDR(args), 0));
 	mark = asLogical(CAD4R(args));
 	if(mark == NA_LOGICAL)
@@ -584,7 +585,7 @@
 	PROTECT(ans = duplicate(x));
 	R_AllocStringBuffer(0, &cbuff);  /* 0 -> default */
 	for(i = 0; i < LENGTH(x); i++) {
-	    si = STRING_ELT(x, i);
+	    si = isRawx ? x : STRING_ELT(x, i);
 	top_of_loop:
 	    inbuf = CHAR(si); inb = LENGTH(si);
 	    outbuf = cbuff.data; outb = cbuff.bufsize - 1;
@@ -622,7 +623,7 @@
 		goto next_char;...
2017 Jul 15
4
readLines without skipNul=TRUE causes crash
...er() )
    Read 1 item
    [1] "346.10"
    > scan( w , n = 1 , what = character() )
    Read 1 item
    [1] "414.40"
    > scan( w , n = 1 , what = character() )
    Error in scan(w, n = 1, what = character()) :
      could not allocate memory (2048 Mb) in C function
'R_AllocStringBuffer'
making a huge single-line file does not reproduce the problem, i think the
embedded nuls have something to do with it--
    # WARNING do not run with less than 64GB RAM
    tf <- tempfile()
    a <- rep( "a" , 1000000000 )
    b <- paste( a , collapse = '' )...
2017 Jul 15
0
readLines without skipNul=TRUE causes crash
...t;346.10"
>     > scan( w , n = 1 , what = character() )
>     Read 1 item
>     [1] "414.40"
>     > scan( w , n = 1 , what = character() )
>     Error in scan(w, n = 1, what = character()) :
>       could not allocate memory (2048 Mb) in C function
> 'R_AllocStringBuffer'
>
>
>
> making a huge single-line file does not reproduce the problem, i think the
> embedded nuls have something to do with it--
>
>
>     # WARNING do not run with less than 64GB RAM
>     tf <- tempfile()
>     a <- rep( "a" , 1000000000 )
>...
2005 Mar 09
1
Encodebuf? yet another memory question
Hi all,
   I was surprised to see this memory error:
Error in scan(Cn.minex13, nlines = 2, quiet = TRUE) : 
        Could not allocate memory for Encodebuf
> memory.size(max=TRUE)
[1] 256843776
> memory.size(FALSE)
[1] 180144528
> memory.limit()
[1] 2147483648
I don't have any objects named 'Encodebuf' and help and the R site
search turn up no matches for this word.  
As
2017 Jul 15
3
readLines without skipNul=TRUE causes crash
...> scan( w , n = 1 , what = character() )
>>     Read 1 item
>>     [1] "414.40"
>>    > scan( w , n = 1 , what = character() )
>>     Error in scan(w, n = 1, what = character()) :
>>       could not allocate memory (2048 Mb) in C function
>> 'R_AllocStringBuffer'
>>
>>
>>
>> making a huge single-line file does not reproduce the problem, i think the
>> embedded nuls have something to do with it--
>>
>>
>>     # WARNING do not run with less than 64GB RAM
>>     tf <- tempfile()
>>     a <-...
2014 Jun 23
2
Unfixed bugs in latest R-patched
...prod(5,c(3,4)))
      The call of crossprod produced an error, whereas the
      corresponding use of %*% does not.
      In pqR-2013-12-29, this bug also affected the expression t(5) %*%
      c(3,4), since it is converted to the equivalent of
      crossprod(5,c(3,4)).
    o Fixed a problem in R_AllocStringBuffer that could result in a
      crash due to an invalid memory access.  (This bug is also present
      in R-2.15.0 and R-3.0.2.)
    o The documentation for aperm now says that the default method does
      not copy attributes (other than dimensions and dimnames).
      Previously, it incorrecty sai...
2017 Jul 16
3
readLines without skipNul=TRUE causes crash
...;>>>     Read 1 item
>>>>     [1] "414.40"
>>>>    > scan( w , n = 1 , what = character() )
>>>>     Error in scan(w, n = 1, what = character()) :
>>>>       could not allocate memory (2048 Mb) in C function
>>>> 'R_AllocStringBuffer'
>>>>
>>>>
>>>>
>>>> making a huge single-line file does not reproduce the problem, i think
>>>> the
>>>> embedded nuls have something to do with it--
>>>>
>>>>
>>>>     # WARNING do not...
2017 Jul 15
0
readLines without skipNul=TRUE causes crash
...what = character() )
>>>     Read 1 item
>>>     [1] "414.40"
>>>    > scan( w , n = 1 , what = character() )
>>>     Error in scan(w, n = 1, what = character()) :
>>>       could not allocate memory (2048 Mb) in C function
>>> 'R_AllocStringBuffer'
>>> 
>>> 
>>> 
>>> making a huge single-line file does not reproduce the problem, i think the
>>> embedded nuls have something to do with it--
>>> 
>>>
>>>     # WARNING do not run with less than 64GB RAM
>>>...
2017 Jul 16
0
readLines without skipNul=TRUE causes crash
...ad 1 item
>>>>>     [1] "414.40"
>>>>>    > scan( w , n = 1 , what = character() )
>>>>>     Error in scan(w, n = 1, what = character()) :
>>>>>       could not allocate memory (2048 Mb) in C function
>>>>> 'R_AllocStringBuffer'
>>>>>
>>>>>
>>>>>
>>>>> making a huge single-line file does not reproduce the problem, i
>think
>>>>> the
>>>>> embedded nuls have something to do with it--
>>>>>
>>>>>
&g...
2017 Jul 15
0
readLines without skipNul=TRUE causes crash
On 15/07/2017 7:35 AM, Anthony Damico wrote:
> hello, the last line of the code below causes a segfault for me on 3.4.1.
> i think i should submit to https://bugs.r-project.org/  unless others have
> advice?  thanks
Segfaults are usually worth reporting as bugs.  Try to come up with a 
self-contained example, not using the lodown and archive packages.  I 
imagine you can do this by
2017 Jul 16
2
readLines without skipNul=TRUE causes crash
...t;>>     [1] "414.40"
> >>>>>    > scan( w , n = 1 , what = character() )
> >>>>>     Error in scan(w, n = 1, what = character()) :
> >>>>>       could not allocate memory (2048 Mb) in C function
> >>>>> 'R_AllocStringBuffer'
> >>>>>
> >>>>>
> >>>>>
> >>>>> making a huge single-line file does not reproduce the problem, i
> >think
> >>>>> the
> >>>>> embedded nuls have something to do with it--
> >...
2017 Jul 15
2
readLines without skipNul=TRUE causes crash
...;>>>     Read 1 item
>>>>     [1] "414.40"
>>>>    > scan( w , n = 1 , what = character() )
>>>>     Error in scan(w, n = 1, what = character()) :
>>>>       could not allocate memory (2048 Mb) in C function
>>>> 'R_AllocStringBuffer'
>>>>
>>>>
>>>>
>>>> making a huge single-line file does not reproduce the problem, i think
>>>> the
>>>> embedded nuls have something to do with it--
>>>>
>>>>
>>>>     # WARNING do not...
2017 Jul 15
2
readLines without skipNul=TRUE causes crash
hello, the last line of the code below causes a segfault for me on 3.4.1.
i think i should submit to https://bugs.r-project.org/  unless others have
advice?  thanks
install.packages( "devtools" )
devtools::install_github("ajdamico/lodown")
devtools::install_github("jimhester/archive")
file_folder <- file.path( tempdir() , "file_folder" )
tf <-
2017 Jul 16
0
readLines without skipNul=TRUE causes crash
...1] "414.40"
>> >>>>>    > scan( w , n = 1 , what = character() )
>> >>>>>     Error in scan(w, n = 1, what = character()) :
>> >>>>>       could not allocate memory (2048 Mb) in C function
>> >>>>> 'R_AllocStringBuffer'
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> making a huge single-line file does not reproduce the problem,
>i
>> >think
>> >>>>> the
>> >>>>> embedded nuls have som...
2017 Jul 17
0
readLines without skipNul=TRUE causes crash
...ad 1 item
>>>>>     [1] "414.40"
>>>>>    > scan( w , n = 1 , what = character() )
>>>>>     Error in scan(w, n = 1, what = character()) :
>>>>>       could not allocate memory (2048 Mb) in C function
>>>>> 'R_AllocStringBuffer'
>>>>>
>>>>>
>>>>>
>>>>> making a huge single-line file does not reproduce the problem, i think
>>>>> the
>>>>> embedded nuls have something to do with it--
>>>>>
>>>>>
>&g...
2017 Jul 17
1
readLines without skipNul=TRUE causes crash
...;
> >> >>>>>    > scan( w , n = 1 , what = character() )
> >> >>>>>     Error in scan(w, n = 1, what = character()) :
> >> >>>>>       could not allocate memory (2048 Mb) in C function
> >> >>>>> 'R_AllocStringBuffer'
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> making a huge single-line file does not reproduce the problem,
> >i
> >> >think
> >> >>>>> the
> >> >...
2007 Sep 07
1
"bug" and patch: quadratic running time for strsplit(..., fixed=TRUE) (PR#9902)
...f[j];
+			memcpy(q, buf, j = strlen(buf));
+			q += j;
 			p += res;
 		    }
 		    i += (res - 1);
Index: src/main/sysutils.c
===================================================================
--- src/main/sysutils.c	(revision 42792)
+++ src/main/sysutils.c	(working copy)
@@ -490,8 +490,9 @@
 			R_AllocStringBuffer(2*cbuff.bufsize, &cbuff);
 			goto top_of_loop;
 		    }
-		    for(j = 0; j < strlen(sub); j++) *outbuf++ = sub[j];
-		    outb -= strlen(sub);
+		    memcpy(outbuf, sub, j = strlen(sub)); 
+		    outbuf += j;
+		    outb -= j;
 		}
 		inbuf++; inb--;
 		goto next_char;
Index: src/modules/X...
2012 Mar 13
0
111 FIXMEs in main/src
...len), 0) + 1;
--
builtin.c:	      /* FIXME:	 call EncodeElement() for every element of
s.
builtin.c-
--
builtin.c:	    /* FIXME : cat(...) should handle ANYTHING */
builtin.c-	    w = strlen(p);
--
character.c:	    slen = strlen(ss); /* FIXME -- should handle embedded
nuls */
character.c-	    buf = R_AllocStringBuffer(slen+1, &cbuff);
--
character.c:		   FIXME: could prefer UTF-8 here
character.c-		 */
--
character.c:	    /* FIXME: could use R_Realloc instead */
character.c-	    cbuf = CallocCharBuf(strlen(tmp) + 1);
--
character.c:		    /* FIXME use this buffer for new string as well */
character.c-		    wc...