Memory leak in file.read() on Solaris?

John Ziniti jziniti at speakeasy.org
Wed May 7 14:28:49 EDT 2003


I've noticed what I think might be a bug in the code that
reads files on Solaris.  The following:

$ dd if=/dev/zero of=file.bin bs=1024 count=20000
$ python2.1
Python 2.1.3 (#4, May  6 2003, 17:46:12)
[GCC 2.95.2 19991024 (release)] on sunos5
Type "copyright", "credits" or "license" for more information.
 >>> file = open('file.bin')
 >>> data = file.read()
 >>> file.close()
 >>> data = None

shows memory usage for python at 98 MB even after "data"
is set to None.  Is this expected behavior?  Under Linux, the
memory is given back at "data = None".  If it helps at all, if I
re-open the file in the same python shell, and read() the
contents again, memory usage stays at 100M, it does not go
up to 200M.

Please CC: me, as I don't subscribe to this list.

Thanks in advance,

John Ziniti






More information about the Python-list mailing list