[Python-checkins]
python/dist/src/Lib/bsddb/test test_recno.py, 1.7, 1.8
greg at users.sourceforge.net
greg at users.sourceforge.net
Sun Jun 27 19:32:36 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib/bsddb/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32305/Lib/bsddb/test
Modified Files:
test_recno.py
Log Message:
SF patch / bug #967763
Fix memory leaks revealed by valgrind and ensuing code inspection.
In the existing test suite valgrind revealed two memory leaks (DB_get
and DBC_set_range). Code inspection revealed that there were many other
potential similar leaks (many on odd code error paths such as passing
something other than a DBTxn object for a txn= parameter or in the face
of an out of memory error). The most common case that would cause a
leak was when using recno or queue format databases with integer keys,
sometimes only with an exception exit.
Index: test_recno.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_recno.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** test_recno.py 21 Sep 2003 00:08:14 -0000 1.7
--- test_recno.py 27 Jun 2004 23:32:34 -0000 1.8
***************
*** 134,137 ****
--- 134,144 ----
print rec
+ # test that non-existant key lookups work (and that
+ # DBC_set_range doesn't have a memleak under valgrind)
+ rec = c.set_range(999999)
+ assert rec == None
+ if verbose:
+ print rec
+
c.close()
d.close()
***************
*** 178,181 ****
--- 185,190 ----
source = os.path.join(os.path.dirname(sys.argv[0]),
'db_home/test_recno.txt')
+ if not os.path.isdir('db_home'):
+ os.mkdir('db_home')
f = open(source, 'w') # create the file
f.close()
More information about the Python-checkins
mailing list