推荐学习书目
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
simple2025
0D
V2EX  ›  Python

有没有什么办法可以知道 Python web 是否有内存泄漏

  •  
  •   simple2025 · Jun 26, 2017 · 3442 views
    This topic created in 3254 days ago, the information mentioned may be changed or developed.

    现在情况是这样的,今天一起来发现 aws 上 supervisor tornado 进程的内存占用好高,以前一般是一个进程 60M 左右 , 今天基本都是 400M 以上,甚至有 900M 的,有没有办法知道怎么内存泄漏了吗

    5 replies    2017-06-26 13:02:37 +08:00
    Morriaty
        1
    Morriaty  
       Jun 26, 2017   ❤️ 1
    python 有 gc 模块
    JhZ7z587cYROBgVQ
        2
    JhZ7z587cYROBgVQ  
       Jun 26, 2017
    查看一下有没有全局变量没删除吧?
    simple2025
        3
    simple2025  
    OP
       Jun 26, 2017 via iPhone
    @jason0916 我都怀疑是 AWS 的问题了
    kinghui
        4
    kinghui  
       Jun 26, 2017   ❤️ 1
    检查一下是否存在相互引用导致 Handler 没有被回收. 因为 Tornado 会为每一个请求构建新的 Handler 处理请求. 如果当前 Handler 的 self 传递给其他对象保存, 同时又把该对应绑定到了 self 上就会产生内存泄露.

    PS. 如果没有引起 OOM 就没啥大问题.
    h280254082
        5
    h280254082  
       Jun 26, 2017   ❤️ 1
    有一个叫 meliae 的库你可以看一眼
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2847 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 41ms · UTC 06:02 · PVG 14:02 · LAX 23:02 · JFK 02:02
    ♥ Do have faith in what you're doing.