[R] long character data

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Jan 31 11:31:05 CET 2000


Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:

> On Mon, 31 Jan 2000, [iso-8859-1] Jens Oehlschlägel-Akiyoshi wrote:
> 
> > When trying to generate very long strings, my R hangs without any error
> > message, even if given much memory.
> 
> [R 0.90.1 on Windows, GUI console I presume.] 
> 
> > # e.g.
> > x <- character(10)
> > for (i in 1:10) x[i] <- paste(1:1000, collapse="abc")
> > paste(x, collapse="")
> > 
> > # or directly
> > paste(1:10000, collapse="abc")
> > 
> > Am I violating any max(nchar(character())) or is this a bug?
> 
> The problem is in displaying them on the Rgui console: this will work in
> Rterm and other versions of R.
> 
> This is already fixed for rw0990.
 
Not quite! On RedHat 6.1, I can crash R with variants of this

If I do  the 2nd example first, and then try the 1st one, I get as far
as this:

...
abc9976abc9977abc9978abc9979abc9980abc9981abc9982abc9983abc9984abc9985abc9986abc9987abc9988abc9989abc9990abc9991abc9992abc9993abc9994abc9995abc9996abc9997abc9998abc9999abc10000"
> x <- character(10)
> for (i in 1:10) x[i]
Program received signal SIGSEGV, Segmentation fault.
0x401c5e79 in chunk_free (ar_ptr=0x4025a040, p=0xd7eef310) at malloc.c:3030
3030    malloc.c: No such file or directory.

which happens inside the readline library called from

#10 0x80db1e6 in R_ReadConsole (prompt=0x4091b0e8 "> ", 
    buf=0xbffff174 "x <- character(10)\n", len=1024, addtohistory=1)
    at ../../../R/src/unix/system.c:198
198                         rl_callback_read_char();
(gdb) 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list