[issue14596] struct.unpack memory leak

Meador Inge report at bugs.python.org
Fri Jul 20 02:27:48 CEST 2012


Meador Inge <meadori at gmail.com> added the comment:

I just read through all this and see three separate points be discussed:

  1. The unbounded caching behavior.
  2. A more compact representation for repeat counts.
  3. Correct __sizeof__ support for struct.

For issue (1) I think this is unfortunate, but I don't think any code changes are required because there is already a way to get the cached and uncached behavior by using the free function or a Struct object, respectively.  I do think adjusting the documentation is appropriate.

As a side note, we do have a private function named 'struct._clearcache' that is used by the regression tests.  If others really think the caching is a problem we could make that public.

Issues (2) and (3) are hijacking this issue IMO.  However, since they are being discussed...  I already implemented something like (2) when reworking the struct data structures for PEP 3118 in issue3132.  Hopefully I will get the PEP 3118 patch pushed through one of these days.

I do think issue (3) should be fixed, but a separate issue should be opened for it.  This issue should just address the caching behavior.  Serhiy, if you open another issue for the __sizeof__ change, then I promise to review ASAP.

----------
stage:  -> patch review

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14596>
_______________________________________


More information about the Python-bugs-list mailing list