Sujet : Re: GIL-Removal Project Takes Another Step (Posting On Python-List Prohibited)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.pythonDate : 20. Mar 2024, 05:14:49
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <utdkb8$19g6t$4@dont-email.me>
References : 1 2 3 4
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On Tue, 19 Mar 2024 17:51:54 -0700, Paul Rubin wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
So even a very simple, seemingly well-behaved Python script, if running
for long enough, would consume more and more memory if it were not for
reference-counting.
That is completely false. It's usual to set a GC to [fix it so it’s not
false] ...
In other words, it’s not “completely” false if you have to do something to
make it false. But that GC process creates its own overhead, not to
mention the latency when there isn’t quite enough memory for an allocation
and you have to wait until the next GC run to proceed. Run the GC a
thousand times a second, and the latency is still 1 millisecond.
With reference counting, most objects are immediately freed as soon as
they are discarded--no need to wait for the next GC run.