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

scrapy 中内存溢出应该怎么调试啊

  •  
  •   touch · May 7, 2014 · 6366 views
    This topic created in 4413 days ago, the information mentioned may be changed or developed.
    跑了一段时间之后发现8G的内存用的只剩下几十MB了,爬虫吃掉的太快。
    看了官方的文档里面有个“使用 trackref 调试内存泄露”,没看到怎么调用。
    不知道有熟悉scrapy的吗?

    在此感谢@marchtea 及其其他翻译scrapy文档的诸位。
    7 replies    2014-05-08 09:41:35 +08:00
    codingpp
        1
    codingpp  
       May 7, 2014
    是减去buffer以后的内存占用吗
    touch
        2
    touch  
    OP
       May 7, 2014
    @codingpp 这个没被告之,估计是加上buffer的。
    marchtea
        3
    marchtea  
       May 7, 2014
    不客气~
    文档上说明了,是调用telnet连接,在终端里头使用prefs()来看的。再看看文档试试呢?
    codingpp
        4
    codingpp  
       May 7, 2014
    @touch top命令看到的是加上buffer的内存占用
    用free -m 看第二行那个是减去buffer的内存占用,这个才是主要看的
    我感觉scrapy内存应该不会用的那么多吧
    reverland
        5
    reverland  
       May 7, 2014
    你是读什么大文件了么……
    touch
        6
    touch  
    OP
       May 8, 2014
    @codingpp 主要每一次爬虫调用都会request,不知道scrapyd中能不能再每一次调度之后释放上一次spider的内存占用
    touch
        7
    touch  
    OP
       May 8, 2014
    @reverland 在一直深度爬行网站
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2947 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 06:57 · PVG 14:57 · LAX 23:57 · JFK 02:57
    ♥ Do have faith in what you're doing.