[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type
Ian O'Shaughnessy added the comment: >I don't know of any language that guarantees all garbage will be collected >"right away". Do you? I'm not an expert in this domain, so, no. I am however attempting to find a way to mitigate this issue. Do you have any suggestions how I can avoid these memory spikes? Weak references? Calling gc.collect() on regular intervals doesn't seem to work consistently. -- ___ Python tracker <https://bugs.python.org/issue41389> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type
Ian O'Shaughnessy added the comment: "Leak" was likely the wrong word. It does appear problematic though. The loop is using a fixed number of variables (yes, there are repeated dynamic allocations, but they fall out of scope with each iteration), only one of these variables occupies 1MB of ram (aside from the static variable). The problem: There's only really one variable occupying 1MB of in-scope memory, yet the app's memory usage can/will exceed 1GB after extended use. At the very least, this is confusing – especially given the lack of user control to prevent it from happening once it's discovered as a problem. -- ___ Python tracker <https://bugs.python.org/issue41389> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type
Ian O'Shaughnessy added the comment: For a long running process (greatly exceeding a million iterations) the uncollected garbage will become too large for the system (many gigabytes). A manual execution of the gc would be required. That seems flawed given that Python is a garbage collected language, no? -- ___ Python tracker <https://bugs.python.org/issue41389> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41389] Garbage Collector Ignoring Some (Not All) Circular References of Identical Type
New submission from Ian O'Shaughnessy : 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(100) - B: Active(940) / Total(100) -- 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 <https://bugs.python.org/issue41389> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com