NetEaseGame / ATX

Smart phone automation tool. Support iOS, Android, WebApp and game.
Apache License 2.0
1.58k stars 422 forks source link

内存泄漏问题 #135

Open Jack-Tian opened 7 years ago

Jack-Tian commented 7 years ago

Version information

What steps will reproduce the problem?

d = atx.connect()
count = 1000
while count:
    print("start")
    rp = Report(d, save_dir='reportasdfasdf/%d' % count)
    rp.patch_uiautomator()
    rp.info("Test started")
    rp.close()
    count -= 1

会发生内存泄漏。请帮忙看看这个问题。

codeskyblue commented 7 years ago

python 内存泄漏吗?

Jack-Tian commented 7 years ago
import gc
import objgraph as objgraph

def diag():
    with open("objgraph.log", 'a+') as f:
        gc.collect()
        objgraph.show_most_common_types(limit=20, file=f)

把diag()放到那个while循环里,可以看到list等的数量在不断增长。 用任务管理器看python进程占的memory也一点一点变大。

wuyisheng commented 7 years ago

同发现泄漏,关掉Report之后就平稳许多了。可以这样规避,用完之后,执行

del rp