Full_Name: Hallgeir Grinde Version: 2.1.1 OS: Windows XP Submission from: (NULL) (144.127.1.1) While using lm(y~(x*z*c*...*v)^2) R crashes/closes if the numbers of variables are at least 8.
R crashes for large formulas in lm() (PR#8180)
7 messages · hallgeir.grinde@elkem.no, Barry Rowlingson, Hallgeir.Grinde@elkem.no +2 more
On Wed, 5 Oct 2005 hallgeir.grinde at elkem.no wrote:
Full_Name: Hallgeir Grinde Version: 2.1.1 OS: Windows XP Submission from: (NULL) (144.127.1.1) While using lm(y~(x*z*c*...*v)^2) R crashes/closes if the numbers of variables are at least 8.
OK, let's try to reproduce that:
x1 <- runif(1000) x2 <- runif(1000) x3 <- runif(1000) x4 <- runif(1000) x5 <- runif(1000) x6 <- runif(1000) x7 <- runif(1000) x8 <- runif(1000) y <- rnorm(1000) fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)
No crash, a quite reasonable fit. Can we please have a reproducible example, as we do ask?
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
Prof Brian Ripley wrote:
OK, let's try to reproduce that:
x1 <- runif(1000)
...
y <- rnorm(1000) fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)
No crash, a quite reasonable fit.
Add one more: > x9 <- runif(1000) works with 8: > fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2) but go 'one over the eight' and: > fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8*x9)^2) Segmentation fault platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 2 minor 1.1 year 2005 month 06 day 20 language R Baz
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-devel/attachments/20051005/1b5dde28/attachment.pl
This is almost certainly C stack overflow, which will be _very_ OS-specific. I can run this 9-var example in Linux with a stacksize of 30Mb, but not the default 10Mb. I tried it with the default stack under valgrind, and it works. Windows versions of R have I believe a stack of 8Mb, and so I suspect are running close to that with 8-var example. The problem appears to be recursion in StripTerm.
On Wed, 5 Oct 2005, Barry Rowlingson wrote:
Prof Brian Ripley wrote:
OK, let's try to reproduce that:
x1 <- runif(1000)
...
y <- rnorm(1000) fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)
No crash, a quite reasonable fit.
Add one more:
x9 <- runif(1000)
works with 8:
fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)
but go 'one over the eight' and:
fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8*x9)^2)
Segmentation fault platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 2 minor 1.1 year 2005 month 06 day 20 language R Baz
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
Hi, Wed, 5 Oct 2005 13:38:12 +0100 (BST) Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote.
This is almost certainly C stack overflow, which will be _very_ OS-specific. I can run this 9-var example in Linux with a stacksize of 30Mb, but not the default 10Mb. I tried it with the default stack under valgrind, and it works. Windows versions of R have I believe a stack of 8Mb, and so I suspect are running close to that with 8-var example. The problem appears to be recursion in StripTerm.
default of stack of ld for Mingw seems to be 2M. see. binutils-2.16.91-20050827-1/ld/emultempl/pe.em 289 D(SizeOfStackReserve,"__size_of_stack_reserve__", 0x200000), How about adding the following to MkRules? MINGW32LDFLAG=-Wl,--stack=33554432 -- http://www.nakama.ne.jp e-mail : EIJI Nakama <nakama at ki.rim.or.jp>
On Thu, 6 Oct 2005, Ei-ji Nakama wrote:
Hi, Wed, 5 Oct 2005 13:38:12 +0100 (BST) Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote.
This is almost certainly C stack overflow, which will be _very_ OS-specific. I can run this 9-var example in Linux with a stacksize of 30Mb, but not the default 10Mb. I tried it with the default stack under valgrind, and it works. Windows versions of R have I believe a stack of 8Mb, and so I suspect are running close to that with 8-var example. The problem appears to be recursion in StripTerm.
default of stack of ld for Mingw seems to be 2M.
Yes thanks I have since found that (from ld --help)
see. binutils-2.16.91-20050827-1/ld/emultempl/pe.em 289 D(SizeOfStackReserve,"__size_of_stack_reserve__", 0x200000), How about adding the following to MkRules? MINGW32LDFLAG=-Wl,--stack=33554432
I have been trying that but I cannot make it work (checking the header). It seems the way that does work is -Wl,--stack=0xA00000. That does allow this example (with 8 vars) to always run on WinXP.
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