[Rd] Windows 2000 crash while using rbind (PR#8225)

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Oct 20 09:08:21 CEST 2005


This is a stack-size issue.  Windows provides only a small stack by 
default (2Mb in R 2.2.0).  Your example will work in R-patched (which has 
a 10Mb stack) and R-devel (which has 10Mb and some stack-checking).

The non-technical summary is that you ran out of resources.  Fortunately 
we have been working on that issue and have builds with more resources.

Why this calculation is taking so much stack needs further investigation.


On Thu, 20 Oct 2005 Tom.Mulholland at dpi.wa.gov.au wrote:

> Windows 2000 reports that "Rgui.exe has generated errors and will be =
> closed by Windows. You will need to restart the program." when using =
> rbind.=20
>
>
> df1 <- data.frame(cbind(x=3D1, y=3D1:1000), fac=3Dsample(LETTERS[1:3], =
> 1000, repl=3DTRUE))
> df2 <- data.frame(cbind(x=3D1, y=3D1:10), fac=3Dsample(LETTERS[4:6], =
> 10, repl=3DTRUE))
> df3 <- data.frame(cbind(x=3D1, y=3D1:1000000), =
> fac=3Dsample(LETTERS[1:3], 1000000, repl=3DTRUE))
> df4 <- rbind(df1,df2)
> df5 <- rbind(df2,df3)
> =20
> =20
> Since this only happens intermittantly and appears to be related to the =
> size of the objects I ran the following code.
>
> sink("rbind test.txt")
> df1 <- data.frame(cbind(x=3D1, y=3D1:10), fac=3Dsample(LETTERS[4:6], 10, =
> repl=3DTRUE))
> for (j in seq(100000,1000000,10000)){
> df2 <- data.frame(cbind(x=3D1, y=3D1:j), fac=3Dsample(LETTERS[1:3], j, =
> repl=3DTRUE))
> print(j)
> df3 <- rbind(df2,df1)
> }
> sink()
>
> the output of rbind test.txt is
> [1] 100000
> [1] 110000
> [1] 120000
> ...
> [1] 510000
> [1] 520000
>
> I then ran=20
>
>
> sink("rbind test 2.txt")
> df1 <- data.frame(cbind(a =3D 1, b =3D 2, c =3D 3, d =3D 4, e =3D 5, f =
> =3D 6, x=3D1, y=3D1:10), fac=3Dsample(LETTERS[4:6], 10, repl=3DTRUE))
> for (j in seq(100000,1000000,10000)){
> df2 <- data.frame(cbind(a =3D 1, b =3D 2, c =3D 3, d =3D 4, e =3D 5, f =
> =3D 6, x=3D1, y=3D1:j), fac=3Dsample(LETTERS[1:3], j, repl=3DTRUE))
> print(j)
> df3 <- rbind(df2,df1)
> }
> sink()
>
> which also stopped at 520000.
>
> I tried to narrow down where the crash takes place but it would appear =
> that it is a moving feast, however both pieces of code always stopped =
> with the same number, somewhere around 520000.
>
>> version
>         _             =20
> platform i386-pc-mingw32
> arch     i386          =20
> os       mingw32       =20
> system   i386, mingw32 =20
> status                 =20
> major    2             =20
> minor    2.0           =20
> year     2005          =20
> month    10            =20
> day      06            =20
> svn rev  35749         =20
> language R=20
>
> One of the examples that has failed for me looks like
> pop <- rbind(om.tp[,c(6,2,4,5,3)],eas[,c(2,1,3,4,5)])
>
>
>> str(om.tp[,c(6,2,4,5,3)])
> `data.frame':   1001384 obs. of  5 variables:
> $ age5 : Factor w/ 18 levels "0 to 4","5 to 9",..: 1 1 1 1 1 2 2 2 2 2 =
> ...
> $ sex  : Factor w/ 2 levels "Females","Males": 1 1 1 1 1 1 1 1 1 1 ...
> $ lga  : Factor w/ 142 levels "Albany (C)","Armadale (C)",..: 21 21 21 =
> 21 21 21 21 21 21 21 ...
> $ count: num  7.33 7.45 7.05 6.31 5.71 ...
> $ year : Factor w/ 41 levels "2001","2002",..: 1 1 1 1 1 1 1 1 1 1 ...
>> str(eas[,c(2,1,3,4,5)])
> `data.frame':   25342 obs. of  5 variables:
> $ age5 : Factor w/ 18 levels "0 to 4","5 to 9",..: 1 1 1 1 1 1 1 1 1 1 =
> ...
> $ sex  : Factor w/ 2 levels "Females","Males": 2 2 2 2 2 2 2 2 2 2 ...
> $ lga  : Factor w/ 142 levels "Albany (C)","Armadale (C)",..: 1 2 3 4 5 =
> 6 7 8 9 10 ...
> $ count: num  1107 2163  532  294  479 ...
> $ year : Factor w/ 5 levels "1991","1996",..: 1 1 1 1 1 1 1 1 1 1 ...
>> gc()
>           used  (Mb) gc trigger  (Mb) max used  (Mb)
> Ncells  3255820  87.0    6193578 165.4  5266303 140.7
> Vcells 22096825 168.6   32770865 250.1 32114295 245.1
>
> Tom Mulholland
> Senior Demographer
> Spatial Information and Research
> State and Regional Policy
> Department for Planning and Infrastructure
> Perth, Western Australia
> +61 (08) 9264 7936
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list