[New-bugs-announce] [issue16606] hashlib memory leak

Thorsten Simons report at bugs.python.org
Tue Dec 4 13:43:32 CET 2012

New submission from Thorsten Simons:

hashlib seems to leak memory when used on a Linux box (whereas the same works fine when run under Windows 7) (tested w/ Python 3.2.1 and 3.2.3)

<snip file "mem.py">
import hashlib

#file = 'B:\\video\\TEST\\01_file_10G'
file = '/video/TEST/01_file_10G'

myhash = hashlib.sha256()

with open(file, "rb") as f:
    for buffer in f:

print('hash =', myhash.hexdigest())

On Windows, 'python3 mem.py' occupies roundabout 7 MB memory,
on Linux (OpenSuse 12.2), it quickly acquires all available memory, then all swap, than get's killed.

components: Library (Lib)
messages: 176907
nosy: Thorsten.Simons
priority: normal
severity: normal
status: open
title: hashlib memory leak
type: resource usage
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list