jutans@utans.u-net.com
2000-Oct-11 15:10 UTC
[Rd] invalid regular expression after many grep's (PR#691)
Full_Name: J Utans Version: 1.1.1 OS: NT4 (SP6) Submission from: (NULL) (155.140.123.250) After grep is called many times (> 250k), with constant strings as patterns, it complains with "invalid regular expression" on calls that worked before (with same pattern and x). At the same time copying to the clipboard does no longer work with "out of memory" error (i.e. when trying to copy the error message from grep to this msg.) Also breaks other functions (regexpr, strsplit) that seems to use the regex functions internally. Things work again after restarting R. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
2000-Oct-11 15:32 UTC
[Rd] invalid regular expression after many grep's (PR#691)
> From: jutans@utans.u-net.com > Date: Wed, 11 Oct 2000 17:10:31 +0200 (MET DST) > To: r-devel@stat.math.ethz.ch > Subject: [Rd] invalid regular expression after many grep's (PR#691) > CC: R-bugs@biostat.ku.dk > X-Loop: R-bugs@biostat.ku.dk > > Full_Name: J Utans > Version: 1.1.1 > OS: NT4 (SP6) > Submission from: (NULL) (155.140.123.250) > > > After grep is called many times (> 250k), with constant strings as patterns, > it complains with "invalid regular expression" on calls that worked before > (with same pattern and x). At the same time copying to the clipboard > does no longer work with "out of memory" error (i.e. when trying to > copy the error message from grep to this msg.) > Also breaks other functions (regexpr, strsplit) that seems to use > the regex functions internally. Things work again after restarting R.Looks like a memory/resource leak. Can you send us an actual failing example on your machine, starting from a clean session, together with details of the machine (amount of RAM etc)? That will help us greatly to reproduce this. -- Brian D. Ripley, ripley@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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
2000-Oct-25 13:25 UTC
[Rd] invalid regular expression after many grep's (PR#691)
Turns out that someone forgot to call regfree in the internal code for strsplit and also forgot to free pt there. After I found those two, there is no more memory build up in your example, although I did not have the patience for 200k calls. (After 1000 there had been appreciable buildup, and there was exactly none after the fixes.) The memory management on the next version of R for Windows will be radically different, and you will be able to set a limit on total malloc-ed space, for example. (R-core: this is an example why one might want to.)> From: "Joachim Utans" <jutans@utans.u-net.com> > To: Prof Brian Ripley <ripley@stats.ox.ac.uk> > Date: Thu, 12 Oct 2000 20:32:40 +0100 > Subject: Re: [Rd] invalid regular expression after many grep's (PR#691) > X-Keywords: > > > While trying to create a simple test it turns out that the real > culprit appears to be strsplit. What I am doing is to parse > many lengthy text-files, perform some substitutions and write out > the results (I probably should use Perl but this also does other R > calculations). Some of the actions performed call strsplit but > the error message always came from grep, but they both call the > underlying regexp functions I assume. > > Below is an example that fails on my machine after around 200k > iterations (this of course is an inappropriate use of strsplit > as the loop is not necessary). > Machine is 2*733 PIII, 256Mb RAM, starting R with --vanilla, > and R_VSIZE=160M, R_NSIZE=1500k. > > > bugtest <- function(n=500, file="d:/rw/faq") { > for (j in 1:n) { > tmp <- scan(file, "", sep="\n") > for (i in 1:length(tmp)) { > x <- strsplit(tmp[i], " ")[[1]] > } > } > } > > After exiting with q(), R then crashes (try to access memory at 0x0000) > N.B. strsplit(.,NULL) does not crash, no regexpr involved(?) > > Come to think of it, when R does crash for me I think a large fraction > of crashes occurs in functions that in some way call strsplit, though > I have not kept track of this.-- Brian D. Ripley, ripley@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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._