V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · 3711 views
    This topic created in 3074 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
        1
    janxin  
       Dec 1, 2017
    内存太小了?
    goodryb
        2
    goodryb  
    OP
       Dec 1, 2017
    @janxin #1 1.6G 不算小吧,程序启动了可以运行几个小时,内存一直增加,然后就被 kill 了
    neoblackcap
        3
    neoblackcap  
       Dec 1, 2017
    phantomjs OOM 很正常,用 chrome headless mode。作者都是这样说
    wzwwzw
        4
    wzwwzw  
       Dec 1, 2017
    为什么不用 chrome headless 呢。
    hahastudio
        5
    hahastudio  
       Dec 1, 2017
    一定要用 phantomjs 的话,可以爬几个页面重启一下 phantomjs
    holyghost
        6
    holyghost  
       Dec 1, 2017
    我已经换到 chrome headless 了
    a7a2
        7
    a7a2  
       Dec 1, 2017
    建议使用 chromedriver,phantomjs 就很容易被识别。。。
    goodryb
        8
    goodryb  
    OP
       Dec 1, 2017
    @neoblackcap #3
    @wzwwzw #4
    @holyghost #6
    @a7a2 #7

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


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

    @Tunar #10 不太清楚呢

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