AW: [Python-Dev] segmentation fault with python2.3a0 from cvs

Guido van Rossum guido@python.org
Mon, 07 Oct 2002 14:53:22 -0400


> as a follow up, here is an interesting behaviour when used with 2.3:
> 
> Python 2.3a0 (#29, Oct  7 2002, 19:54:53) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> b = {}
> [3319 refs]
> >>> for i in range(1000000):
> ...     b[i]=[i]*60
> ...
> [62003414 refs]
> >>> for k in range(1000000):
> ...     del b[k]
> ...
> [1003419 refs]
> >>> print b[0]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> KeyError: 0
> [1003458 refs]
> >>> print len(b.keys())
> 0
> [1003621 refs]
> 
> The funny thing is, the memory allocated by python_d.exe *INCREASES* when I
> do the del b[k]-bit thingy. OK, so I guess its time to do a gc:

No, there are no cycles in the data structures you create here.

I suspect another CYGWIN malloc bug.

--Guido van Rossum (home page: http://www.python.org/~guido/)