Franckx Laurent
2012-Nov-09 10:43 UTC
[R] Error in memory.size(size) when calling R in batch mode (but not in interactive mode)
Dear all I use a 64 bit Windows7 system with 16 GB memory. I have run an R script in batch mode with the following command: R CMD BATCH masterassignment_2012_11_09.r --save The execution was terminated with the following error message: Error in memory.size(size) : don't be silly!: your machine has a 4Gb address limit I never get this error message in an interactive session (and I don't think I should, taking into account the system). To be sure, I have just double checked this again in an interactive session, and it works fine. There are two possible explanations I can think of: a) The command line doesn't "know" the system, i.e. it "thinks" it works on a 32bit system (is this possible at all?) b) I run R on a remote desktop, and the command line thinks I am calling R from my laptop Anyway, I wouldn't know how to solve this. In case you wonder why I run R in batch mode at all: I have a series of iterations in my model, each of which is taking huge amount of memory. Although I regularly impose a garbage collection, after two or three iterations, R crashes when used interactively. I thought that running and exiting R after each iteration would be the only effective way to "clean up" memory. If you have any other solutions, I would be happy to hear about them as well. Laurent Franckx, PhD VITO NV Boeretang 200, 2400 MOL, Belgium Tel. + 32 14 33 58 22 Skype: laurent.franckx laurent.franckx at vito.be Visit our website: www.vito.be/english and http://www.vito.be/transport ________________________________ [http://www.vito.be/e-maildisclaimer/bsds.png] <http://bsds.vito.be> VITO Disclaimer: http://www.vito.be/e-maildisclaimer
Milan Bouchet-Valat
2012-Nov-09 13:33 UTC
[R] Error in memory.size(size) when calling R in batch mode (but not in interactive mode)
Le vendredi 09 novembre 2012 ? 10:43 +0000, Franckx Laurent a ?crit :> Dear all > > I use a 64 bit Windows7 system with 16 GB memory. > I have run an R script in batch mode with the following command: > R CMD BATCH masterassignment_2012_11_09.r --save > The execution was terminated with the following error message: > > Error in memory.size(size) : don't be silly!: your machine > has a 4Gb address limit > > > I never get this error message in an interactive session (and I don't > think I should, taking into account the system). To be sure, I have > just double checked this again in an interactive session, and it works > fine. > > There are two possible explanations I can think of: > a) The command line doesn't "know" the system, i.e. it "thinks" it > works on a 32bit system (is this possible at all?) > b) I run R on a remote desktop, and the command line thinks I am > calling R from my laptopc) When you run "R CMD BATCH", the 32-bit version of R is used, while when you run it interactively, you start the 64-bit version. To check this, add sessionInfo() to your batch script, and have a look at the output. Hope this helps> Anyway, I wouldn't know how to solve this. > > In case you wonder why I run R in batch mode at all: I have a series > of iterations in my model, each of which is taking huge amount of > memory. Although I regularly impose a garbage collection, after two or > three iterations, R crashes when used interactively. I thought that > running and exiting R after each iteration would be the only effective > way to "clean up" memory. If you have any other solutions, I would be > happy to hear about them as well. > > > > Laurent Franckx, PhD > VITO NV > Boeretang 200, 2400 MOL, Belgium > Tel. + 32 14 33 58 22 > Skype: laurent.franckx > laurent.franckx at vito.be > Visit our website: www.vito.be/english and http://www.vito.be/transport > > > > > > > ________________________________ > [http://www.vito.be/e-maildisclaimer/bsds.png] <http://bsds.vito.be> > > VITO Disclaimer: http://www.vito.be/e-maildisclaimer > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Franckx Laurent
2013-Feb-04 08:21 UTC
[R] error occurring in batch mode, not interactive mode: how to find cause of problem
Dear all, I use R version 2.15.1 on x86_64-pc-linux-gnu (64-bit). I run a simulation where I have to call a series of R scripts in batch mode. When I run the following two lines, this works well for PERIOD='17' but not for PERIOD='08': R CMD BATCH --no-save "--args PERIOD='08' YEAR='203O' SC='BAU' " preparecostvectors.R preparecostvectors08_2030.Rout R CMD BATCH --no-save "--args PERIOD='17' YEAR='2030' SC='BAU' " preparecostvectors.R preparecostvectors17_2030.Rout The error message I get for PERIOD='08' is (but I do not think this is relevant for my main question): Error in names(votlist) <- votname : 'names' attribute [3] must be the same length as the vector [0] I get this error message for all values of YEAR. Oddly enough, when I run the script preparecostvectors.R interactively, all works perfectly fine. However, this is not a structural solution, because I need to be able to run my simulation for a large number of years. I was wondering if any tools exist that could help me to reconstruct what went wrong in batch mode. I think I am familiar with most debugging tools in interactive mode, but how can I trace the origin of the problem when I get an error in batch mode? Just to avoid any misunderstanding: I am not asking any help on the error message itself, just some suggestions on how I could trace what goes wrong when running R in batch mode. Laurent Franckx, PhD VITO NV Boeretang 200, 2400 MOL, Belgium Tel. + 32 14 33 58 22 Skype: laurent.franckx laurent.franckx at vito.be Visit our website: www.vito.be/english and http://www.vito.be/transport VITO Disclaimer: http://www.vito.be/e-maildisclaimer