R on Windows running in RStudio produces a grossly incorrect result for memory.limit() (which should be in Mb) even though the command works perfect fine in the standard Windows RGui.
Here's what I get in a fresh session in RStudio on a machine with 16 Gb of RAM:
> memory.limit()
[1] 1.759219e+13
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1    packrat_0.5.0 
and in the RGUI:
> memory.limit()
[1] 16111
which is correct.
Thoughts?
             
            
              
                
           
          
            
            
              This is being tracked on this github issue
  
  
    
  
  
    
    
      
        opened 02:54PM - 20 Jun 19 UTC 
      
        
          closed 09:07PM - 15 Oct 19 UTC 
        
      
     
    
        
          bug
         
        
          reproducible
         
    
   
 
  
    On Windows 10 64bit
Base R's memory.limit() function reports wildly different…  results in (a) R Console and (b) RStudio 1.3.2xx's console for R 3.6.0.
R3.5.3 reports 16279, as expected on my system, in both RConsole and RStudio.
R3.6.0 reports 16279 (R Console) and erroneously reports 17592186044416 (RStudio console)
memory.limit() results:
 .  | R 3.5.3 | R 3.6.0
---|---|---
R Console | 16279 | 16279
RStudio 1.3.2xx | 16279 | 17592186044416
```
######################################################################################
# R 3.5.3 (R console)
######################################################################################
> Sys.info()
       sysname        release        version        machine 
     "Windows"       "10 x64"  "build 16299"       "x86-64" 
> R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.3                         
year           2019                        
month          03                          
day            11                          
svn rev        76217                       
language       R                           
version.string R version 3.5.3 (2019-03-11)
nickname       Great Truth                 
> rstudioapi::getVersion()
Error: RStudio not running
> memory.limit()
[1] 16279
> memory.size()
[1] 41.87
######################################################################################
# R 3.6.0 (R console)
######################################################################################
> Sys.info()
       sysname        release        version         machine 
     "Windows"       "10 x64"  "build 16299"         "x86-64" 
> R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          6.0                         
year           2019                        
month          04                          
day            26                          
svn rev        76424                       
language       R                           
version.string R version 3.6.0 (2019-04-26)
nickname       Planting of a Tree          
> rstudioapi::getVersion()
Error: RStudio not running
> memory.limit()
[1] 16279
> memory.size()
[1] 42.77
######################################################################################
# R 3.5.3 (RStudio)
######################################################################################
> Sys.info()
       sysname        release        version      machine    
     "Windows"       "10 x64"  "build 16299"     "x86-64"    
> R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.3                         
year           2019                        
month          03                          
day            11                          
svn rev        76217                       
language       R                           
version.string R version 3.5.3 (2019-03-11)
nickname       Great Truth                 
> rstudioapi::getVersion()
[1] ‘1.3.236’
> memory.limit()
[1] 16279
> memory.size()
[1] 74.1
######################################################################################
# R 3.6.0 (RStudio)
######################################################################################
> Sys.info()
       sysname        release        version      machine    
     "Windows"       "10 x64"  "build 16299"     "x86-64"    
> R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          6.0                         
year           2019                        
month          04                          
day            26                          
svn rev        76424                       
language       R                           
version.string R version 3.6.0 (2019-04-26)
nickname       Planting of a Tree          
> rstudioapi::getVersion()
[1] ‘1.3.236’
> memory.limit()
[1] 1.759219e+13
> memory.size()
[1] 43.41
######################################################################################
# R 3.5.3 (RStudio)
######################################################################################
> Sys.info()
       sysname        release        version      machine    
     "Windows"       "10 x64"  "build 16299"     "x86-64"    
> R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.3                         
year           2019                        
month          03                          
day            11                          
svn rev        76217                       
language       R                           
version.string R version 3.5.3 (2019-03-11)
nickname       Great Truth                 
> rstudioapi::getVersion()
[1] ‘1.3.260’
> memory.limit()
[1] 16279
> memory.size()
[1] 74.43
######################################################################################
# R 3.6.0 (RStudio)
######################################################################################
> Sys.info()
       sysname        release        version      machine    
     "Windows"       "10 x64"  "build 16299"     "x86-64"    
> R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          6.0                         
year           2019                        
month          04                          
day            26                          
svn rev        76424                       
language       R                           
version.string R version 3.6.0 (2019-04-26)
nickname       Planting of a Tree          
> rstudioapi::getVersion()
[1] ‘1.3.260’
> memory.limit()
[1] 1.759219e+13
> memory.size()
[1] 55.22
``` 
   
   
  
    
    
  
  
 
             
            
              
           
          
            
              
                system  
              
                  
                    August 17, 2019,  3:31pm
                   
                  3 
               
             
            
              This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.