bzr heads consumes > 3GB of memory

John Arbash Meinel john at arbash-meinel.com
Tue Nov 25 16:31:59 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicholas Allen wrote:
> Hi,
> 
> I branched an svn repository with bazaar. It has around 60000 revisions
> in it. When I run "bzr heads" in the shared repository all my available
> RAM (> 3GB) is consumed and bzr crashes with an out of memory exception.
> 
> This command should be instant and use practically no memory. It only
> has to find the revisions that don't have any parent revisions...
> 
> Nick
> 
> 

Actually, it needs to find revisions which have no *children* revisions,
which is a bit more difficult. (If you only store references to parents,
you then have to go to every node and invert it to get the list of only
children.)

Further, it doesn't do only that (at least last I used it.) It compares
the list of revisions with no children with the list of known branches,
and returns entries that have no children that are not also branch tips.

As mentioned elsewhere, the memory leak seems to be in trying to find
all possible branches, possibly with an interaction with the bzr-svn plugin.


I'll not that in my local repository doing just "bzr heads" without any
options finishes in about 12s and consumes 43MB of RAM.

Doing "bzr heads --dead-only" is only marginally slower, and doesn't
consume any more peak memory (but I don't have bzr-svn installed.)

I'm a bit confused about the actual output of "bzr heads", though.
Considering that:

$ bzr heads | grep "^HEAD" | wc -l
57
$ bzr heads --dead-only | grep "^HEAD" | wc -l
170

I suppose the default action is to only show you the revisions which are
"alive", aka the tip revision of a branch. Since "bzr heads --all"
returns 227 for my repository.



Also, another way to see if it is "bzr-svn" is to do:
  bzr branches

Which doesn't inspect the revision graph, and only tries to open the
branches that it can find. I believe it also tries to open every
directory as a branch. If that also consumes 3GB of RAM, then it is most
likely bzr-svn that is the problem, and not the "heads" command.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkksKH8ACgkQJdeBCYSNAAPoHwCeKvQv28HlI1G2n2Ak0qpRFL8A
BPgAni+cOGtlSPR5BfG01rjo2REHckCe
=7Mkx
-----END PGP SIGNATURE-----



More information about the bazaar mailing list