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

[求助] Python 调用 phantomjs 老是因为 Out of memory 被 kill

  •  
  •   goodryb · Dec 1, 2017 · 4201 views
    This topic created in 3260 days ago, the information mentioned may be changed or developed.
    Supplement 1  ·  Dec 6, 2017
    切换到 chrome headless 后就没问题了,内存占用很小

    确认是 phantomjs 的锅
    12 replies  •  2017-12-01 20:35:01 +08:00
    janxin
    janxin
    Dec 1, 2017
    1
    内存太小了?
    goodryb
    goodryb
    OP
    Dec 1, 2017
    2
    @janxin #1 1.6G 不算小吧,程序启动了可以运行几个小时,内存一直增加,然后就被 kill 了
    neoblackcap
    neoblackcap
    Dec 1, 2017
    3
    phantomjs OOM 很正常,用 chrome headless mode。作者都是这样说
    wzwwzw
    wzwwzw
    Dec 1, 2017
    4
    为什么不用 chrome headless 呢。
    hahastudio
    hahastudio
    Dec 1, 2017
    5
    一定要用 phantomjs 的话,可以爬几个页面重启一下 phantomjs
    holyghost
    holyghost
    Dec 1, 2017
    6
    我已经换到 chrome headless 了
    a7a2
    a7a2
    Dec 1, 2017
    7
    建议使用 chromedriver,phantomjs 就很容易被识别。。。
    goodryb
    goodryb
    OP
    Dec 1, 2017
    8
    @neoblackcap #3
    @wzwwzw #4
    @holyghost #6
    @a7a2 #7

    好吧,看来我用到的工具落后了,已经更换到了 chrome headless,今天跑一跑,看看情况


    @hahastudio #5 这个有点麻烦,解决方法不是太优雅
    gouchaoer
    gouchaoer
    Dec 1, 2017
    9
    新的就用 chrome headless,老的懒得切就继续 phantomjs 咯
    Tunar
    Tunar
    Dec 1, 2017 via Android
    10
    作者不是溜了么。。
    BiggerLonger
    BiggerLonger
    Dec 1, 2017
    11
    chrome 沒有像 phantomjs 那樣的 web server 模塊吧?
    goodryb
    goodryb
    OP
    Dec 1, 2017
    12
    @gouchaoer #9 个人用,所以切换比较方便

    @Tunar #10 不太清楚呢

    @BiggerLonger #11 我感觉两种方式差不多,chrome 需要一个额外的 chromedriver
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1384 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 20:18 · PVG 04:18 · LAX 12:18 · JFK 15:18
    ♥ Do have faith in what you're doing.