microsoft / RTVS

R Tools for Visual Studio.
MIT License
389 stars 118 forks source link

C stack size in R Interactive session #4311

Open Ilia-Kosenkov opened 6 years ago

Ilia-Kosenkov commented 6 years ago

Error: C stack usage 1993168 is too close to the limit is thrown while constructing a pretty large plot using ggplot2. The Cstack_info() inside this session gives

   size current  direction eval_depth 
1992294    9496          1          2 

StackOverflow solutions suggest to increase stack size on a *nix machine using ulimit.

However, if I run R session outside of the Visual Studio (e.g. in console by typing R.exe), this same script executes fine and Cstack_info() gives

    size current  direction eval_depth 
63753420    9272          1          2 

According to the manual, the size is reported in bytes and is expected to be accurate when measured on machines running Windows (and some other systems), and outside of Visual Studio environment it is ~30 times larger.

In this particular case I can bypass this limit by rearranging my plot commands, but some other complex tasks can fail due to this limit.

A way to control such specific settings of an instance of R running in RTVS could solve this problem.

System info:

R Services Information:
Local R: C:\Program Files\Microsoft\R_Open\R-3.4.1\
Version: 1.3.40104.1351
Operating System: Microsoft Windows 10.0.16299 
CPU Count: 8
Physical Memory: 24523 MB, 15982 MB free
Virtual Memory: 28619 MB, 18396 MB free
Video controller[1]: NVIDIA GeForce GTX 660
GPU[1]: GeForce GTX 660
Connected users: 1

R info: Microsoft R Open 3.4.1.0

R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)
Packages ---------------------------------------------------------------------
 package       * version    date       source                              
 assertthat      0.2.0      2017-04-11 CRAN (R 3.4.1)                      
 base          * 3.4.1      2017-09-06 local                               
 bindr           0.1        2016-11-13 CRAN (R 3.4.1)                      
 bindrcpp      * 0.2        2017-06-17 CRAN (R 3.4.1)                      
 broom           0.4.2      2017-02-13 CRAN (R 3.4.0)                      
 cellranger      1.1.0      2016-07-27 CRAN (R 3.4.1)                      
 coda          * 0.19-1     2016-12-08 CRAN (R 3.4.1)                      
 codetools       0.2-15     2016-10-05 CRAN (R 3.4.1)                      
 colorspace      1.3-2      2016-12-14 CRAN (R 3.4.1)                      
 combinat      * 0.0-8      2012-10-29 CRAN (R 3.4.1)                      
 compiler        3.4.1      2017-09-06 local                               
 curl            2.8.1      2017-07-21 CRAN (R 3.4.1)                      
 datasets      * 3.4.1      2017-09-06 local                               
 devtools      * 1.13.3     2017-08-02 CRAN (R 3.4.1)                      
 digest          0.6.12     2017-01-27 CRAN (R 3.4.1)                      
 doSNOW        * 1.0.14     2015-10-14 CRAN (R 3.4.1)                      
 dplyr         * 0.7.2      2017-07-20 CRAN (R 3.4.1)                      
 filehash        2.4-1      2017-04-07 CRAN (R 3.4.1)                      
 forcats         0.2.0      2017-01-23 CRAN (R 3.4.1)                      
 foreach       * 1.4.3      2015-10-13 CRAN (R 3.4.1)                      
 foreign         0.8-69     2017-06-21 CRAN (R 3.4.1)                      
 ggplot2       * 2.2.1.9000 2018-04-05 Github (tidyverse/ggplot2@3c9c504)  
 git2r           0.19.0     2017-07-19 CRAN (R 3.4.1)                      
 glue            1.1.1      2017-06-21 CRAN (R 3.4.1)                      
 graphics      * 3.4.1      2017-09-06 local                               
 grDevices     * 3.4.1      2017-09-06 local                               
 grid          * 3.4.1      2017-09-06 local                               
 gtable          0.2.0      2016-02-26 CRAN (R 3.4.1)                      
 haven           1.1.0      2017-07-09 CRAN (R 3.4.1)                      
 hms             0.3        2016-11-22 CRAN (R 3.4.1)                      
 httr            1.3.1      2017-08-20 CRAN (R 3.4.1)                      
 iterators     * 1.0.8      2015-10-13 CRAN (R 3.3.1)                      
 jsonlite        1.5        2017-06-01 CRAN (R 3.4.1)                      
 labeling        0.3        2014-08-23 CRAN (R 3.4.1)                      
 lattice         0.20-35    2017-03-25 CRAN (R 3.4.1)                      
 lazyeval        0.2.0      2016-06-12 CRAN (R 3.4.1)                      
 lubridate       1.6.0      2016-09-13 CRAN (R 3.4.1)                      
 magrittr        1.5        2014-11-22 CRAN (R 3.4.1)                      
 MASS          * 7.3-47     2017-04-21 CRAN (R 3.4.1)                      
 memoise         1.1.0      2017-04-21 CRAN (R 3.4.1)                      
 methods       * 3.4.1      2017-09-06 local                               
 mnormt          1.5-5      2016-10-15 CRAN (R 3.4.1)                      
 modelr          0.1.1      2017-07-24 CRAN (R 3.4.1)                      
 munsell         0.4.3      2016-02-13 CRAN (R 3.4.1)                      
 nlme            3.1-131    2017-02-06 CRAN (R 3.4.1)                      
 parallel      * 3.4.1      2017-09-06 local                               
 pkgconfig       2.0.1      2017-03-21 CRAN (R 3.4.1)                      
 plyr            1.8.4      2016-06-08 CRAN (R 3.4.1)                      
 psych           1.7.5      2017-05-03 CRAN (R 3.4.1)                      
 purrr         * 0.2.3      2017-08-02 CRAN (R 3.4.1)                      
 R6              2.2.2      2017-06-17 CRAN (R 3.4.1)                      
 RColorBrewer  * 1.1-2      2014-12-07 CRAN (R 3.4.1)                      
 Rcpp            0.12.12    2017-07-15 CRAN (R 3.4.1)                      
 readr         * 1.1.1      2017-05-16 CRAN (R 3.4.1)                      
 readxl          1.0.0      2017-04-18 CRAN (R 3.4.1)                      
 reshape2        1.4.2      2016-10-22 CRAN (R 3.4.1)                      
 RevoUtils       10.0.5     2017-09-06 local                               
 RevoUtilsMath * 10.0.0     2017-04-19 local                               
 rjags         * 4-6        2016-02-19 CRAN (R 3.4.1)                      
 rlang         * 0.2.0.9001 2018-04-05 Github (r-lib/rlang@49d7a34)        
 RLibs         * 0.2.5      2018-04-19 Github (Ilia-Kosenkov/RLibs@741f3f0)
 rstudioapi      0.6        2016-06-27 CRAN (R 3.4.1)                      
 rtvs            1.0.0.0    <NA>       local                               
 rvest           0.3.2      2016-06-17 CRAN (R 3.4.1)                      
 scales          0.5.0.9000 2018-02-06 Github (hadley/scales@d767915)      
 snow          * 0.4-2      2016-10-14 CRAN (R 3.4.1)                      
 stats         * 3.4.1      2017-09-06 local                               
 stringi         1.1.5      2017-04-07 CRAN (R 3.4.1)                      
 stringr       * 1.2.0      2017-02-18 CRAN (R 3.4.1)                      
 tibble        * 1.3.4      2017-08-22 CRAN (R 3.4.1)                      
 tidyr         * 0.7.0      2017-08-16 CRAN (R 3.4.1)                      
 tidyverse     * 1.1.1      2017-01-27 CRAN (R 3.4.1)                      
 tikzDevice    * 0.10-1     2016-02-10 CRAN (R 3.4.1)                      
 tools           3.4.1      2017-09-06 local                               
 utils         * 3.4.1      2017-09-06 local                               
 withr           2.1.2      2018-04-05 Github (jimhester/withr@79d7b0d)    
 xml2            1.1.1      2017-01-24 CRAN (R 3.4.1)