Hi Robert,

I looked at it a little closer, and the problem was a nasty missing
Py_DECREF() in rinterface.c's newSEXP(). People mostly creating their
vectors/arrays with R were not much subject to the problem, which may
explain why there were only sporadic complains about a process growing
in size.

The fix is already in bitbucket's 2.1-dev, as well as backported to the
2.0.x branch. 

The bug is serious enough to trigger a bugfix release 2.0.4 soon (within
a week, I think).


L.


On Thu, 2009-04-23 at 12:29 +1000, Denham Robert wrote:
> I know this was raised before, and I saw a suggestion that using
> gc.collect seemed to fix things, but I am getting I think a memory leak
> in rpy2 which doesn't seem to occur in rpy. This could be how I am
> coding things of course. Here is an example:
> 
> import rpy2.robjects as robjects
> from numpy import *
> import rpy2.robjects.numpy2ri
> import gc
>  
> robjects.r('set.seed(99813)')
> aa = array(robjects.r.runif(205))
> bb = arange(0,1,step=1/205.0)robjects.r('library(locfit)')
> lfraw = robjects.globalEnv.get("locfit.raw")
> 
> ##and try this many times:
> for i in range(90000):
>   if i%1000==0:
>     gc.collect()
>     print i
>   res = lfraw(bb,aa)
> 
> 
> If I monitor this using top, the memory use steadily increases. This
> does not happen with the equivalent code in rpy. We would like to use
> some R functions many times, so the memory leak is of concern. Does
> anyone have any insight to this problem -- perhaps I can modify my code
> to avoid it, or should we go back to rpy?
> 
> I am using rpy2 2.0.3 on linux on 64bit suse running R-2.8.0
> 
> 
> 
> 
> Thanks
> Robert
> 
> 
> As of 26 March 2009 the Department of Natural Resources and 
> Water/Environmental Protection Agency integrated to form the Department of 
> Environment and Resource Management
> 
> Queensland celebrates its 150th anniversary in 2009. Check out what's on 
> today at http://www.q150.qld.gov.au
> 
> ************************************************************************
> The information in this email together with any attachments is intended only 
> for the person or entity to which it is addressed and may contain 
> confidential and/or privileged material.
> Any form of review, disclosure, modification, distribution and/or publication 
> of this email message is prohibited, unless as a necessary part of 
> Departmental business.
> If you have received this message in error, you are asked to inform the 
> sender as quickly as possible and delete this message and any copies of this 
> message from your computer and/or your computer system network.
> ************************************************************************
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and 
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today. 
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to