Comment 10 for bug 494406

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 494406] Re: Smart server leaks memory each commit

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

Gareth White wrote:
> Let me know if you need me to provide any more information to make this
> a confirmed bug. Since the leak is fairly small I'll work around it by
> restarting the server once a week or so.
>

So I think I've tracked it down to a leak in the bzrlib.bencode.bencode
functionality. Specifically:

>>> from bzrlib import trace, bencode
>>> trace.enabled_default_logging()
>>> l = ['a string', {'a': 'dict'}, 234234, 'a really big string'*10000]
>>> trace.debug_memory()
WorkingSize 10636KB PeakWorking 10636KB
>>> for i in xrange(200):
... enc = bencode.bencode(l)
...
>>> trace.debug_memory()
WorkingSize 48996KB PeakWorking 48996KB

So memory went from 11M to 49MB.

Note that I don't see the same result for the bdecoder

>>> for i in xrange(200):
... m = bdecode.bdecode(enc)
...
>>> trace.debug_memory()
WorkingSize 49212KB PeakWorking 49212KB

As expected, bdecode only increased the memory ~ as much as the new 'm'
object.

Will dig further.

John
=:->

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

iEYEARECAAYFAksr7b8ACgkQJdeBCYSNAAMC3ACg0ZDcHegIVZykbAIqY/CKo0Gz
dzQAoKcFZbAPvnRKYFy0RyFqEG6L16Xe
=g2RX
-----END PGP SIGNATURE-----