durusmail: durus-users: Memory leak: Minimal bugfix in "_persistent.c"
Memory leak: Minimal bugfix in "_persistent.c"
2006-05-12
doubt about durus 3.4 inner working (was: Re: [Durus-users] Memory leak: Minimal bugfix in "_persistent.c")
2006-05-12
2006-05-12
important: 3.4 tarball updated.
2006-05-12
Memory leak: Minimal bugfix in "_persistent.c"
Jesus Cea
2006-05-12
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Looking at (not yet studying it :) the new Durus 3.4 code, I see a small
bug:

When we touch a persistent object, we do:

"""
if (connection != Py_None) {
  self->p_touched = ((ConnectionBaseObject*)connection)->sync_count;
  Py_INCREF(self->p_touched);
}
"""

So we increase the refcounter for the sync_count number, but we never
decrement it, so the "sync_count" objects will never be released. As a
result, we leak a "sync_count" object by transaction (commited and aborted).

The fix is trivial: add a Py_DECREF just before the asigment.

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea@argo.es http://www.argo.es/~jcea/ _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea@jabber.org         _/_/    _/_/          _/_/_/_/_/
                               _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBRGTCX5lgi5GaxT1NAQLDkQP/evKP3/fMiy+GVGePdkLtAi1FX9QCLRAp
NAh9nwH09Zo1GOar047dglYXiD2k5Jv5U5ObhJthtV0+Nsk5kvPpz/Zn/cr86lEF
vRRT1weYE3902wQhS0vWnPyPPktZ2nCF1Eu8nfndi2Aaxg9EaBxnqM5UQCsbMkTX
TiedKqzGc1w=
=+F80
-----END PGP SIGNATURE-----
reply