V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
SlipStupig
V2EX  ›  Python

Python 内存泄露怎么能快速诊断?

  •  
  •   SlipStupig · 2017-07-18 19:50:23 +08:00 · 3706 次点击
    这是一个创建于 2446 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我用 tornado 写了一个 API 服务器,但是貌似出现了内存泄露问题,内存一直在增长不释放,由于项目有点大,不可能用 memory_profile, 有什么办法可以可以发现到泄露点呢?

    2 条回复    2017-07-19 11:11:02 +08:00
    keakon
        1
    keakon  
       2017-07-19 10:41:03 +08:00   ❤️ 1
    其实大多数时候没啥好办法,因为一般你写不出能内存泄露的代码,这些问题基本都是第三方库导致的。粗暴的话就每隔一段时间或处理一定请求后自动重启进程,非要找找可以参考这篇 http://www.jianshu.com/p/2d06a1a01cc3
    tryer3000
        2
    tryer3000  
       2017-07-19 11:11:02 +08:00   ❤️ 1
    flask 写 web app,开发环境开启 debug,每个未捕获的异常会长 4M 内存
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2767 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 12:33 · PVG 20:33 · LAX 05:33 · JFK 08:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.