Re: [pysqlite] unusual memory behavior

Roger Binns <[email protected]> Thu, 28 May 2009 09:58:12 -0700
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gerhard H=E4ring wrote:
> Suggestions on how to do this weakref management in a better/simpler way
> are of course welcome. But it must work from the Python C API. Basically
> it needs use weakref.ref and/or weakref.proxy and lists/dicts, etc.

In APSW I have the same list of weakrefs (the 'dependents' member of
Connection).  But I also get the 'remove' method of the list:

 http://code.google.com/p/apsw/source/browse/apsw/trunk/src/connection.c#340

Then I pass the remove method as the cleanup parameter to
PyWeakref_NewRef which means the item is automatically removed from the
list on going dead.  Example:

 http://code.google.com/p/apsw/source/browse/apsw/trunk/src/connection.c#545

It works perfectly.

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

iEYEARECAAYFAkoewpoACgkQmOOfHg372QSE3gCeIGZyfzypp5k/hGVgKtjkQ7zl
90IAnAw5AsMD6dwKOZSAmLlhW/oH+6+T
=3DO0Zm
-----END PGP SIGNATURE-----