A question on modification of a list via a function invocation

Steve D'Aprano steve+python at pearwood.info
Thu Aug 17 08:23:10 EDT 2017


On Thu, 17 Aug 2017 10:02 pm, Stefan Ram wrote:

> ram at zedat.fu-berlin.de (Stefan Ram) writes:
>>Python uses a reference-counting memory reclaimer, so the
>>reference count of the OEBEA now is 2.
> 
>   IIRC, the reference-counting memory reclaimer (RCMC) is not
>   required by the language specification. The language
>   specification allows other kinds of memory management. But a
>   certain widespread Python implementation uses an RCMC as its
>   default way to manage memory.


CPython uses *two* garbage collectors, a reference counter, plus a second one
which runs periodically to collect unused object cycles which can't be
collected by the ref counter. You can enable or disable the second one using
the gc module.

You are correct that reference counting is not required by the language.

Jython uses the JRE's native garbage collector, and IronPython uses the .Net
CLR's garbage collector. One major difference between their GC's and CPython's
is that objects in Jython and IronPython can be moved in memory.

PyPy can be built with different sorts of garbage collectors, mostly
experimental.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list