Hi, All
I have a problem of R memory space.
I am getting "Error: cannot allocate vector of size 198.4 Mb"
------------------------------
I've tried with:
> memory.limit(size=2047);
[1] 2047
> memory.size(max=TRUE);
[1] 12.75
> library('RODBC');
> Channel<-odbcConnectAccess('c:/test.MDB'); # inputdata:15 cols, 2000000
rows, 173 MB
> x<-sqlFetch(Channel,'data1');
> odbcCloseAll();
> gc(TRUE)
Garbage collection 69 = 2+2+65 (level 2) ...
3.6 Mbytes of cons cells used (38%)
183.8 Mbytes of vectors used (36%)
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 134456 3.6 350000 9.4 350000 9.4
Vcells 24082306 183.8 67102875 512.0 78179534 596.5
> memory.size()
[1] 192.16
> NROW(x)
[1] 2000000
> x
YEAR MONTH ACT_AMT T M_WEIGHT ACT_AMTSUM GROWTH COMPCNT COMPCV
MODLCNT MODLCV FLAG_1 FLAG_2 PRICE HIGHEND_AMT
1 2002 1 511997 1 0.01563573 32745313 1.0000000 2
132.41674 13 170.54307 1 0 11906.91 0.2871111
2 2002 2 2254900 2 0.06886176 32745313 1.0000000 2
113.06057 17 176.79751 0 0 35232.81 0.4922613
....
> hbnreg<-function(data,option)
+ {
+ for(i in 1:NROW(option)) {
+ nam<-paste(substring(option[i],1,nchar(option[i])-2))
+ if(substring(option[i],nchar(option[i]))=='T') assign(nam,TRUE)
+ else assign(nam,FALSE)
+ }
+
x<-lm("ACT_AMT~T+M_WEIGHT+ACT_AMTSUM+GROWTH+COMPCNT+COMPCV+MODLCNT+MODLCV+FL
AG_1+FLAG_2+PRICE+HIGHEND_AMT",data=data)
+ y=list()
+ if(summary==TRUE){
+ z<-summary(x)
+ y$coefficients<-z$coefficients
+ y$residuals<-z$residuals
+ }
+ #if(influence==TRUE){
+ #z<-influence(x)
+ #y$hat<-z$hat
+ }
+
+ y
+ }
> y<-hbnreg(x,c('summary=T','influence=T'));
Error:cannot allocate vector of size 198.4 Mb <---- error
-------------------------------------
my work enviroment :
> version _
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 11.1
year 2010
month 05
day 31
svn rev 52157
language R
version.string R version 2.11.1 (2010-05-31)
- PC OS : 32bit WinXP pro sp3
- PC RAM : 1 GB
- Virtual memory : 1524 MB
----------------------------------
Could it be an hardware problem?
Thanks and best regards.
Young-Ju, Park
from Korea
[1][rKWLzcpt.zNp8gmPEwGJCA00]
[@from=dllmain&rcpt=r%2Dhelp%40r%2Dproject%2Eorg&msgid=%3C20100831101740%2EH
M%2E0000000000000do%40dllmain%2Ewwl737%2Ehanmail%2Enet%3E]
References
1. mailto:dllmain at hanmail.net
Error: cannot allocate vector of size 198.4 Mb
3 messages · 나여나, Steve Lianoglou, Rafael Björk
Hi,
On Mon, Aug 30, 2010 at 9:17 PM, ??? <dllmain at hanmail.net> wrote:
? ?Hi, All ? I have a problem of R memory space. ? I am getting "Error: cannot allocate vector of size 198.4 Mb"
It's a RAM thing: you don't have enough. The OS said "nice try" when R tried asked for that last 198.4 MB's of RAM chunk of RAM. This question comes up quite often. Read through some of these if your still confused: http://search.gmane.org/search.php?group=gmane.comp.lang.r.general&query=cannot+allocate+vector+of+size -steve
? ------------------------------
? I've tried with:
? > memory.limit(size=2047);
? [1] 2047
? > memory.size(max=TRUE);
? [1] 12.75
? > library('RODBC');
? > Channel<-odbcConnectAccess('c:/test.MDB'); ?# inputdata:15 cols, 2000000
? rows, 173 MB
? > x<-sqlFetch(Channel,'data1');
? > odbcCloseAll();
? > gc(TRUE)
? Garbage collection 69 = 2+2+65 (level 2) ...
? 3.6 Mbytes of cons cells used (38%)
? 183.8 Mbytes of vectors used (36%)
? ? ? ? ? ? ?used ?(Mb) gc trigger ?(Mb) max used ?(Mb)
? Ncells ? 134456 ? 3.6 ? ? 350000 ? 9.4 ? 350000 ? 9.4
? Vcells 24082306 183.8 ? 67102875 512.0 78179534 596.5
? > memory.size()
? [1] 192.16
? > NROW(x)
? [1] 2000000
? > x
? ? ?YEAR MONTH ?ACT_AMT ?T ? M_WEIGHT ACT_AMTSUM ? ?GROWTH COMPCNT ? ?COMPCV
? MODLCNT ? ?MODLCV FLAG_1 FLAG_2 ? ? PRICE HIGHEND_AMT
? 1 ?2002 ? ? 1 ? 511997 ?1 0.01563573 ? 32745313 1.0000000 ? ? ? 2
? 132.41674 ? ? ?13 170.54307 ? ? ?1 ? ? ?0 ?11906.91 ? 0.2871111
? 2 ?2002 ? ? 2 ?2254900 ?2 0.06886176 ? 32745313 1.0000000 ? ? ? 2
? 113.06057 ? ? ?17 176.79751 ? ? ?0 ? ? ?0 ?35232.81 ? 0.4922613
? ....
? > hbnreg<-function(data,option)
? + {
? + for(i in 1:NROW(option)) {
? + nam<-paste(substring(option[i],1,nchar(option[i])-2))
? + if(substring(option[i],nchar(option[i]))=='T') assign(nam,TRUE)
? + else assign(nam,FALSE)
? + }
? +
? x<-lm("ACT_AMT~T+M_WEIGHT+ACT_AMTSUM+GROWTH+COMPCNT+COMPCV+MODLCNT+MODLCV+FL
? AG_1+FLAG_2+PRICE+HIGHEND_AMT",data=data)
? + y=list()
? + if(summary==TRUE){
? + z<-summary(x)
? + y$coefficients<-z$coefficients
? + y$residuals<-z$residuals
? + }
? + #if(influence==TRUE){
? + #z<-influence(x)
? + #y$hat<-z$hat
? + }
? +
? + y
? + }
? > y<-hbnreg(x,c('summary=T','influence=T'));
? Error:cannot allocate vector of size 198.4 Mb ?<---- error
? -------------------------------------
? my work enviroment :
? > version ? ? ? ? ? ? ? _
? platform ? ? ? i386-pc-mingw32
? arch ? ? ? ? ? i386
? os ? ? ? ? ? ? mingw32
? system ? ? ? ? i386, mingw32
? status
? major ? ? ? ? ?2
? minor ? ? ? ? ?11.1
? year ? ? ? ? ? 2010
? month ? ? ? ? ?05
? day ? ? ? ? ? ?31
? svn rev ? ? ? ?52157
? language ? ? ? R
? version.string R version 2.11.1 (2010-05-31)
? - PC OS : 32bit WinXP pro sp3
? - PC RAM : 1 GB
? - Virtual memory : 1524 MB
? ----------------------------------
? Could it be an hardware problem?
? Thanks and best regards.
? Young-Ju, Park
? from Korea
? [1][rKWLzcpt.zNp8gmPEwGJCA00]
? [@from=dllmain&rcpt=r%2Dhelp%40r%2Dproject%2Eorg&msgid=%3C20100831101740%2EH
? M%2E0000000000000do%40dllmain%2Ewwl737%2Ehanmail%2Enet%3E]
References
? 1. mailto:dllmain at hanmail.net
______________________________________________ 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.
Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100831/262046fd/attachment.pl>