Message374210
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) |
|
Date |
User |
Action |
Args |
2020-07-24 19:56:23 | ian_osh | set | recipients:
+ ian_osh |
2020-07-24 19:56:23 | ian_osh | set | messageid: <1595620583.22.0.931401196723.issue41389@roundup.psfhosted.org> |
2020-07-24 19:56:23 | ian_osh | link | issue41389 messages |
2020-07-24 19:56:23 | ian_osh | create | |
|