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

为什么 Python 工程师很少像 Java 工程师那样讨论垃圾回收?

  •  
  •   idacker · Dec 11, 2015 · 4603 views
    This topic created in 3809 days ago, the information mentioned may be changed or developed.

    最近开始接触大数据,也越来越多遇到这方面的各种问题。这个问题群里的大神帮助解答下呗。为什么 Python 工程师很少像 Java 工程师那样讨论垃圾回收? Java 开发的时候经常讨论垃圾回收策略,什么并行串行 G1 垃圾回收器之类的;而做 Python 开发的这几年,好像鲜有人讨论这些;两者都是自动回收内存,为何在内存回收这块会有这个差别?

    9 replies    2015-12-11 20:53:52 +08:00
    geeklian
        1
    geeklian  
       Dec 11, 2015 via iPhone
    不止 python ,动态语言都很少有人谈论垃圾回收吧……
    halfcrazy
        2
    halfcrazy  
       Dec 11, 2015
    默认不那么 care 性能
    linnchord
        3
    linnchord  
       Dec 11, 2015   ❤️ 2
    mathgl
        4
    mathgl  
       Dec 11, 2015
    loqixh
        5
    loqixh  
       Dec 11, 2015
    python 以指针计数为主,一般和没 GC 区别不大,不过开发 c 模块就要哭了
    vanxining
        6
    vanxining  
       Dec 11, 2015 via Android
    楼上正解。引用计数是个很古老的技术,现在几乎不再发展了,也没什么改进的余地,无论是对解释器还是脚本代码。
    kaneg
        7
    kaneg  
       Dec 11, 2015 via iPhone
    如 @halfcrazy 所说, python 并不以高性能著称,甚至由于 GIL 的原因而无法享受多核带来的好处,所以对 GC 的性能并没有那么强烈的依赖,在日常的使用中几乎不需要考虑 GC
    JamesPan
        8
    JamesPan  
       Dec 11, 2015
    因为 Python 的回收不会 stop the world 吧
    clino
        9
    clino  
       Dec 11, 2015
    python 貌似不用像 java 那样预先分配一大堆内存
    当然有内存泄露也会占用越来越多的内存 所以有时候简单的方法是定期重启
    不过不太会像 java 那样碰到内存不足的问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   921 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 19:52 · PVG 03:52 · LAX 12:52 · JFK 15:52
    ♥ Do have faith in what you're doing.