[New-bugs-announce] [issue11802] filecmp.cmp needs a documented way to clear cache

jeff deifik report at bugs.python.org
Fri Apr 8 05:37:24 CEST 2011


New submission from jeff deifik <jeff at jeffunit.com>:

I have a program which calls filecmp.cmp a lot.
It runs out of memory.
I read the source to filecmp, and then I periodically set
filecmp._cache = {}

Without doing this, filecmp's cache uses up all the memory in the computer.

There needs to be a documented interface to clear the cache.

I suggest a function
def clear_cache:
    _cache = {}

Without a documented interface, there is no standard way to clear the
cache. It is possible different versions of python will require
different methods to clear the cache, which will reduce python code
portability and is a bad idea.

Alternatively, one might disable the caching code.

One shouldn't have to look at the source code of a library function
to see why it is consuming memory.

----------
messages: 133290
nosy: lopgok
priority: normal
severity: normal
status: open
title: filecmp.cmp needs a documented way to clear cache
versions: Python 2.7

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


More information about the New-bugs-announce mailing list