id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
18426 Memory leaks in RootSystem tscrim sage-combinat "`RootSystem` is currently creating memory leaks in the following way:
Upon creating a root system, say of type B3, this line:
{{{
self.dual = RootSystem(self._cartan_type.dual(), as_dual_of=self);
}}}
causes the B3 root system to be used as a key in the `UniqueRepresentation` of the C3 root system (I call it so, but note it is the dual of the B3, which will be different than the honest C3 root system), which is a strong reference that can never be deleted. Moreover, the B3 root system then holds a (strong) reference to the C3 root system, so the C3 root system never gets collected either.
Some data:
{{{
sage: from collections import Counter
sage: import gc
sage: gc.collect()
349
sage: pre = {id(a) for a in gc.get_objects()}
sage: get_memory_usage()
8697.9453125
sage: for n in range(5, 3000):
....: RS = RootSystem(['A', n])
....:
sage: gc.collect()
106
sage: get_memory_usage()
8703.08984375
sage: post = Counter(str(type(a)) for a in gc.get_objects() if id(a) not in pre)
sage: sorted([p for p in post.items() if p[1] > 2000])
[("""", 6123),
("""", 5985),
("""", 2991),
("""", 30460),
("""", 9003)]
}}}" enhancement new critical sage-6.7 memleak memory leak sage-combinat nthiery slelievre Travis Scrimshaw N/A