New submission from Ian O'Shaughnessy <ian_...@apple.com>:
Using a script that has two classes A and B which contain a circular reference variable, it is possible to cause a memory leak that is not captured by default gc collection. Only by running gc.collect() manually do the circular references get collected. Attached is a sample script that replicates the issue. Output starts: Ram used: 152.17 MB - A: Active(125) / Total(2485) - B: Active(124) / Total(2484) Ram used: 148.17 MB - A: Active(121) / Total(12375) - B: Active(120) / Total(12374) Ram used: 65.88 MB - A: Active(23) / Total(22190) - B: Active(22) / Total(22189) Ram used: 77.92 MB - A: Active(35) / Total(31935) - B: Active(34) / Total(31934) After 1,000,000 cycles 1GB of ram is being consumed: Ram used: 1049.68 MB - A: Active(1019) / Total(975133) - B: Active(1018) / Total(975132) Ram used: 1037.64 MB - A: Active(1007) / Total(984859) - B: Active(1006) / Total(984858) Ram used: 952.34 MB - A: Active(922) / Total(994727) - B: Active(921) / Total(994726) Ram used: 970.41 MB - A: Active(940) / Total(1000000) - B: Active(940) / Total(1000000) ---------- files: gc.bug.py messages: 374210 nosy: ian_osh priority: normal severity: normal status: open title: Garbage Collector Ignoring Some (Not All) Circular References of Identical Type type: resource usage versions: Python 3.7 Added file: https://bugs.python.org/file49337/gc.bug.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41389> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com