Opened 4 years ago

Closed 3 years ago

#25560 closed defect (invalid)

Memory leak in root system

Reported by: nbruin Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: memleak Keywords:
Cc: Merged in:
Authors: Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

import gc
from collections import Counter
gc.collect()
pre={id(a) for a in gc.get_objects()}
for n in [1..50]:
  r=RootSystem(['A',n])
del r
gc.collect()
T=Counter(str(type(a)) for a in gc.get_objects() if id(a) not in pre)
[t for t in T.iteritems() if 'RootSystem' in t[0]]

prints

[("<class 'sage.combinat.root_system.root_system.RootSystem'>", 100)]

The as_dual_of creation parameter ensures a permanent reference is introduced to the dual root system in its UniqueRepresentation construction parameter key.

Probably a solution would be to use a UniqueFactory instead, which can preprocess its arguments before storing them as a key in a global dict. To be safe, perhaps strip the key down to just integers and strings (that should be quite doable here).

Change History (3)

comment:1 Changed 4 years ago by nbruin

  • Milestone changed from sage-8.3 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Duplicate of #18426.

comment:2 Changed 4 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

comment:3 Changed 3 years ago by embray

  • Resolution set to invalid
  • Status changed from positive_review to closed

Presuming these are all correctly reviewed as either duplicate, invalid, or wontfix.

Note: See TracTickets for help on using tickets.