bsddb crashes on windows

Vijay Rao vijay at accellion.com
Mon Mar 10 00:48:04 EST 2003


At 09:37 07/03/2003 -0600, you wrote:

>     Vijay> Does this mean that if I use bsddb3 with Python 2.2 I wont have
>     Vijay> to make any change when I use the same code base with Python 2.3.
>
>     Skip> Correct.  You can still call bsddb.hashopen(...) to open a
>     Skip> database file.
>
>My mistake.  I read a bit too fast and missed the "3".  If you want to use
>code in the distribution you'll have to change your imports at least.  On
>the other hand, if you installed PyBSDDB (aka bsddb3) separately, just
>reinstall it using Python 2.3 and you should be okay.  You'll have two
>versions of the same package installed, but it shouldn't be a problem unless
>there's a name clash at the C level.


I tried using bsddb3-4.1.0.win32-py2.2.exe on WinXP
with Python 2.2.1.
Iterating through a btree seems to be resulting a in open
Handles ( viewable in processes , Windows Task
Manager ). About 1 handle per 20 entries in the
database is added and it is not freed even when the db
is closed. The same code ( below ) does not result in
any such handles for the bsddb module that is part of
python.


def getTreeSize(type_db3,tree_path) :

         if type_db3 :
             tree_handle = bsddb3.btopen(tree_path)
         else :
             tree_handle = bsddb.btopen(tree_path)
         size = 0
         try :
             try :
                 entry = tree_handle.first()
             except :
                 traceback.print_exc()
                 return 0
             else :
                 size += 1
             while 1:
                 try :
                     tree_handle.next()
                 except :
                     traceback.print_exc()
                     break
                 else :
                     size += 1
         except :
             traceback.print_exc()
         tree_handle.close()
         return size

Could this be memory leak somewhere ?

vr








More information about the Python-list mailing list