[New-bugs-announce] [issue2058] reduce tarfile memory footprint

Lars Gustäbel report at bugs.python.org
Sun Feb 10 12:44:03 CET 2008

New submission from Lars Gustäbel:

tarfile.py wastes lots of memory resources. The memory consumption does
not depend on the size of an archive but on the numbers of members in it.
The attached patch reduces memory usage by about 60% and consists of two
independent strategies (each with about 30% reduction):

1. Add __slots__ to the TarInfo class. This was proposed in issue1540385
a while ago but rejected due to backward-compatibility issues.

2. Remove the undocumented buf attribute of the TarInfo class. buf
stores the original 512-byte header block read from the archive. This
was introduced in r45954 and is rather useless except for GNUTYPE_SPARSE
processing. This might as well be a candidate for backporting to 2.6.

assignee: lars.gustaebel
components: Library (Lib)
files: tarfile-memory.diff
keywords: patch
messages: 62248
nosy: lars.gustaebel
priority: normal
severity: normal
status: open
title: reduce tarfile memory footprint
type: resource usage
versions: Python 3.0
Added file: http://bugs.python.org/file9399/tarfile-memory.diff

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list