[RFC] Out of memory during BzrDir.find_branches

Andrew Bennetts andrew at canonical.com
Mon Apr 21 01:34:45 BST 2008


Jonathan Lange wrote:
> Hello,
> 
> I was doing some work on the bzr-removable plugin yesterday, and was
> having some problems with BzrDir.find_branches. Specifically, when I
> run it on one of my other projects it takes a while, chews up CPU and
> memory and then raises an out-of-memory error.

I get that with the bzr-svn plugin installed, and otherwise it's fine.  It seems
to be a memory leak that happens with *some* combinations of bzr-svn and the
python subversion bindings (but not all).

> Taking a peak at the implementation, I notice that it builds all of
> the open branches into a big list. This seems bound to cause problems.
> Would it be a good thing to make BzrDir.find_branches an iterator?
> 
> I can imagine that there are other, deeper memory consumption issues
> at play here. Still, making find_branches an iterable means that
> bzr-removable could use it.

See:
http://bundlebuggy.aaronbentley.com/request/%3C20080408013939.GA16870@steerpike.home.puzzling.org%3E

I think to address Robert's concerns about that branch, I should add a test to
make sure that interleaving other operations with iterating the find_branches
iterator works correctly.  If necessary I'd also explicitly use "return
list(...)" in RemoteBzrDir.find_branches to make that test pass.

-Andrew.




More information about the bazaar mailing list