memory leak in Python 2.1/FreeBSD? [was Re: Garbage collection on strike?]

Robin Becker robin at jessikat.fsnet.co.uk
Thu May 17 03:47:29 EDT 2001


In article <Pine.LNX.4.33.0105170003030.912-100000 at C800000-A.potlnd1.or.
home.com>, greg jorgensen <greg at C800000-A.potlnd1.or.home.com> writes
....
>
>The suspect code is a loop:
>
>  f = open('filename', 'rb')
>  while 1:
>      buf = f.read(blocksize)
>      if not buf: break
>      # buf is sent over open ftp connection
>      conn.send(buf)
>
>(It's an overriden version of ftplib.FTP.storbinary that writes a '#' to
>stdout for each block transferred).
...
The return of an empty buffer may happen for reasons other than EOF
especially on traditional UN*X systems. Typically some signal other than
the expected one occurs and pre-empts the I/O signal. Looking in the
fileobject.c source code it seems that this certainly is allowed for.

>Any ideas on why this works on my Linux box (128 megs of RAM) but fails
>reliably in the same place on the FreeBSD box (64 megs)?
>
>Thanks!
>
>Greg Jorgensen
>gregj at pobox.com
>
>
>

-- 
Robin Becker



More information about the Python-list mailing list