[Tutor] Shelve doesn't free up memory

Emile van Sebille emile at fenx.com
Mon Mar 30 15:55:20 CEST 2009


Timo wrote:

<snip>

> # Results file
> import shelve
> 
> def read_result(person):
>    results = []
> 
>    s = shelve.open(RESULTFILE)
>    try:
>        results = s[person]


Maybe passing this out prevents s from being garbage collected?

Emile


>    except KeyError:
> #        print "No results for this person"
>        pass
>    finally:
>        s.close()
> 
>    return results
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list