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
touch
V2EX  ›  Python

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

  •  
  •   touch · 2014-05-07 17:30:02 +08:00 · 5570 次点击
    这是一个创建于 3634 天前的主题,其中的信息可能已经有所发展或是发生改变。
    跑了一段时间之后发现8G的内存用的只剩下几十MB了,爬虫吃掉的太快。
    看了官方的文档里面有个“使用 trackref 调试内存泄露”,没看到怎么调用。
    不知道有熟悉scrapy的吗?

    在此感谢@marchtea 及其其他翻译scrapy文档的诸位。
    7 条回复    2014-05-08 09:41:35 +08:00
    codingpp
        1
    codingpp  
       2014-05-07 17:34:46 +08:00
    是减去buffer以后的内存占用吗
    touch
        2
    touch  
    OP
       2014-05-07 17:54:23 +08:00
    @codingpp 这个没被告之,估计是加上buffer的。
    marchtea
        3
    marchtea  
       2014-05-07 19:25:05 +08:00
    不客气~
    文档上说明了,是调用telnet连接,在终端里头使用prefs()来看的。再看看文档试试呢?
    codingpp
        4
    codingpp  
       2014-05-07 21:53:19 +08:00
    @touch top命令看到的是加上buffer的内存占用
    用free -m 看第二行那个是减去buffer的内存占用,这个才是主要看的
    我感觉scrapy内存应该不会用的那么多吧
    reverland
        5
    reverland  
       2014-05-07 23:09:55 +08:00
    你是读什么大文件了么……
    touch
        6
    touch  
    OP
       2014-05-08 09:40:36 +08:00
    @codingpp 主要每一次爬虫调用都会request,不知道scrapyd中能不能再每一次调度之后释放上一次spider的内存占用
    touch
        7
    touch  
    OP
       2014-05-08 09:41:35 +08:00
    @reverland 在一直深度爬行网站
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3528 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 04:56 · PVG 12:56 · LAX 21:56 · JFK 00:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.