seems like this is a problem with large datasets and rpy2. The python
code will fail, the R will not.
If I reduce the data size to 5000000, both snippets will work.

===python code run in IDLE===
import os
os.environ['R_HOME'] = 'C:/Users/anup/Documents/red/develop/R/R-2.9.2'
import rpy2.robjects as rpy2

count = 200
for x in range(count):
    print 'round' , x
    rpy2.r('a<-rnorm(50000000)')
    rpy2.r('gc()')

===ERROR===
    rpy2.r('a<-rnorm(50000000)')
  File "C:\Python26\lib\site-packages\rpy2\robjects\__init__.py", line
536, in __call__
    res = self.eval(p)
  File "C:\Python26\lib\site-packages\rpy2\robjects\__init__.py", line
423, in __call__
    res = super(RFunction, self).__call__(*new_args, **new_kwargs)
RRuntimeError: Error: cannot allocate vector of size 381.5 Mb



==R code run in windows RGui.exe==
for( x in 1:200){
    print(x)
    a<-rnorm(50000000)
    gc()
}

Any suggestions??

Thanks,
Anup


On Sun, Jan 2, 2011 at 11:13 PM, Anup Parikh <anup.par...@gmail.com> wrote:
> I am using rpy2.0.8 on windows and finding that the following script
> keeps taking memory as it processes the loop. since the call to rnorm
> is never assigned, i'm not sure how to release the memory? Is this a
> bug in 2.0.8? Any suggestions would be helpful.
>
>
> import os
> os.environ['R_HOME'] = 'C:/Users/anup/Documents/red/develop/R/R-2.9.2'
> import rpy2.robjects as rpy2
>
> for x in range(20):
>    rpy2.r('rnorm(50000000)')
>    rpy2.r('gc()')
>
>
> Thanks,
> Anup
>

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to