Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

内存泄漏问题 #135

Open
Jack-Tian opened this issue Jul 21, 2017 · 3 comments
Open

内存泄漏问题 #135

Jack-Tian opened this issue Jul 21, 2017 · 3 comments

Comments

@Jack-Tian
Copy link

Jack-Tian commented Jul 21, 2017

Version information

  • ATX Version: 1.1.3.dev6
  • Python Version: Python 2.7.13

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
Copy link
Member

python 内存泄漏吗?

@Jack-Tian
Copy link
Author

Jack-Tian commented Jul 21, 2017

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
Copy link

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

del rp

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants