Livio Bertacco
2018-Oct-01 16:29 UTC
[Rd] unexpected memory.limit on windows in embedded R
Dear All, I'm linking R from another application and embedding it as described in the R-exts manual, i.e. with initialization done via Rf_initEmbeddedR. While everything works the same as in standalone R for Linux, under Windows I found a difference in the default memory.limit, which is fixed to 2GB (both win32 and win64) - compared to a limit in standalone R of 3.5GB for win32 and 16GB on win64 (which is the amount of physical memory I have). So I wonder if this is just undocumented (at least, I couldn't find any mention of it) or unintentional. All I could find is the following: - man page of memory.limit doesn't mention a default 2GB limit, especially not on win64; - man page of memory.limit and rw-FAQ Q2.9 say that you can set the limit via --max-mem-size or R_MAX_MEM_SIZE env var: both work only in standalone R (Rf_initEmbeddedR ignores them); - R\src\gnuwin32\system.c defines R_size_t R_max_memory = INT_MAX; which is the reason of the 2GB default limit on embedded R; however INT_MAX is not the maximum integer value of an R_size_t variable either on win32 nor on win64; - line 879 of the same system.c source says: "/* set defaults for R_max_memory. This is set here so that embedded applications get no limit */" (meaning that that code is executed only for standalone R) which suggests that, at some point, the intention for embedded R was to impose no limit by default and maybe the INT_MAX value is a mistake. Thank you in advance, Livio [[alternative HTML version deleted]]
Tomas Kalibera
2018-Oct-17 14:47 UTC
[Rd] unexpected memory.limit on windows in embedded R
Dear Livio, thank you for the report. Fixed in R-devel, 75450. Best Tomas On 10/01/2018 06:29 PM, Livio Bertacco wrote:> Dear All, > I'm linking R from another application and embedding it as described in the > R-exts manual, i.e. with initialization done via Rf_initEmbeddedR. > While everything works the same as in standalone R for Linux, under Windows > I found a difference in the default memory.limit, which is fixed to 2GB > (both win32 and win64) - compared to a limit in standalone R of 3.5GB for > win32 and 16GB on win64 (which is the amount of physical memory I have). > > So I wonder if this is just undocumented (at least, I couldn't find any > mention of it) or unintentional. > All I could find is the following: > - man page of memory.limit doesn't mention a default 2GB limit, especially > not on win64; > - man page of memory.limit and rw-FAQ Q2.9 say that you can set the limit > via --max-mem-size or R_MAX_MEM_SIZE env var: both work only in standalone > R (Rf_initEmbeddedR ignores them); > - R\src\gnuwin32\system.c defines > R_size_t R_max_memory = INT_MAX; > which is the reason of the 2GB default limit on embedded R; however > INT_MAX is not the maximum integer value of an R_size_t variable either on > win32 nor on win64; > - line 879 of the same system.c source says: "/* set defaults for > R_max_memory. This is set here so that embedded applications get no limit > */" (meaning that that code is executed only for standalone R) which > suggests that, at some point, the intention for embedded R was to impose no > limit by default and maybe the INT_MAX value is a mistake. > > Thank you in advance, > Livio > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel