Message362873
I referenced an Exception object in a function and found memory usage will increase constantly in the accident. I think it may be a bug.
I wrote a minimal code to reproduce it.
```py
from threading import local, Thread
from time import sleep
l = {}
def t0():
b = l.get('e') # memory usage won't increase if I remove this line
try:
raise Exception('1')
except Exception as e:
l['e'] = e
def target():
while True:
sleep(0.0001)
t0()
target()
# t = Thread(target=target)
# t.daemon = True
# t.start()
```
I tried to execute it in IPython and got the following output:
```
In [1]: run py/ref_exception_causes_oom.py
In [2]: import objgraph
In [3]: objgraph.show_growth(limit=3)
frame 78792 +78792
Exception 78779 +78779
traceback 78779 +78779
In [4]: objgraph.show_growth(limit=3)
Exception 100862 +22083
traceback 100862 +22083
frame 100875 +22083
In [5]: objgraph.show_growth(limit=3)
Exception 115963 +15101
traceback 115963 +15101
frame 115976 +15101
```
And I tried to execute this code in python2.7 and pypy. Both of them won't occur this problem. |
|
Date |
User |
Action |
Args |
2020-02-28 11:18:30 | wangjie | set | recipients:
+ wangjie |
2020-02-28 11:18:30 | wangjie | set | messageid: <1582888710.58.0.0521565801778.issue39782@roundup.psfhosted.org> |
2020-02-28 11:18:30 | wangjie | link | issue39782 messages |
2020-02-28 11:18:30 | wangjie | create | |
|