[Tutor] Shelve doesn't free up memory
Emile van Sebille
emile at fenx.com
Tue Mar 31 19:27:47 CEST 2009
> Emile van Sebille schreef:
>> Timo wrote:
>>> # Results file
>>> import shelve
>>> def read_result(person):
>>> results = 
>>> s = shelve.open(RESULTFILE)
>>> results = s[person]
>> Maybe passing this out prevents s from being garbage collected?
> What do you mean by passing out?
You're returning (passing out) results to the caller, which holds
(perhaps) a reference to s...
> I also tried gc.collect(), but no difference.
... which may be preventing garbage collection.
More information about the Tutor