Hi all,
Title kind of says it all. Does the GC run in a different thread in free threaded python (like it does in Java), or do you explicitly need to create a GC thread?
If it doesn’t, should it by default?
Hi all,
Title kind of says it all. Does the GC run in a different thread in free threaded python (like it does in Java), or do you explicitly need to create a GC thread?
If it doesn’t, should it by default?
There this, cpython/InternalDocs/garbage_collector.md at main · python/cpython · GitHub
I’m hoping the GC never behaves like .NET’s collector
Thanks for the link.
Interesting. The free threaded GC isn’t generational and has 2 stop the world points…
No it runs in the same thread that invoked the GC. If it’s invoked manually via gc.collect()
, then it’s whatever thread called gc.collect()
. If it’s scheduled automatically, then it’s whatever thread first noticed that the GC needs to be run.
There aren’t any immediate plans to change this, but there are a few things we may consider in the future:
I’m not sure I understand this part of the question. You don’t need to explicitly create a GC thread.
I meant is it like java where a thread to perform GC is automatically created?
And evidently the answer is “no”.