Skip to content

Commit e99a0c5

Browse files
committed
added comment explaining use of WeakValueDictionary
1 parent cc543a3 commit e99a0c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pyensembl/ensembl_release.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def normalize_init_values(cls, release, species, server):
4444
species = check_species_object(species)
4545
return (release, species, server)
4646

47+
# Using a WeakValueDictionary instead of an ordinary dict to prevent a
48+
# memory leak in cases where we test many different releases in sequence.
49+
# When all the references to a particular EnsemblRelease die then that
50+
# genome should also be removed from this cache.
4751
_genome_cache = WeakValueDictionary()
4852

4953
@classmethod

0 commit comments

Comments
 (0)