Giter Site home page Giter Site logo

关于垃圾回收 about bat_interviews HOT 6 OPEN

lengyue1024 avatar lengyue1024 commented on July 27, 2024
关于垃圾回收

from bat_interviews.

Comments (6)

lengyue1024 avatar lengyue1024 commented on July 27, 2024

可以参考一下这篇文章https://foofish.net/python-gc.html

from bat_interviews.

xxleyi avatar xxleyi commented on July 27, 2024

我看了上面这篇文章,提到的「标记清除」所涉及到的参考文档中并未提及到 Python,更像是针对垃圾回收各类策略的介绍。

我又查了一下,如果以下参考并无太大问题的话,至少在目前的 CPython 实现中,还未采用「标记清除」算法。
Garbage Collection for Python
Making Python 3 more attractive [LWN.net]

以及,在下面这个对比 Python 和 Ruby 的对比中的说法是「某种程度上类似」,那这意思就是不是喽?

In a way, Python’s GC algorithm resembles the mark and sweep algorithm Ruby uses.

Generational GC in Python and Ruby | via @codeship

from bat_interviews.

wen-fei avatar wen-fei commented on July 27, 2024

提了呀,仔细看

from bat_interviews.

xxleyi avatar xxleyi commented on July 27, 2024

咦,奇怪,怎么感觉和上一次看到的完全不一样…

不管这些了。

问题是在我的了解里, Python 并未引入标记清除,只是在使用引用计数和分代回收相配合。

from bat_interviews.

wen-fei avatar wen-fei commented on July 27, 2024

标准的Cpython确实只提了你说的那两个,我又仔细查了一下,理解是这样的:分代回收需要标记清除配合。

from bat_interviews.

xxleyi avatar xxleyi commented on July 27, 2024

分代回收中的标记清除应该不是通常的标记清除垃圾回收算法吧?但我确实也不确定,只是觉得这样有点太迂回。

之后有机会再详细了解下。

多谢耐心回复~

from bat_interviews.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.