On Monday, 19 May 2025 at 16:01:12 UTC, Python wrote:
If I am using the integrated Windows Thread Pool (1), how this will interact with garbage collection?
It won't even know this threads exists, this also means that your next question:
Is there any risk that some objects are never freed or some are freed too soon?
Because the GC is unaware of these threads any objects will be early freed. What you can do however, since you know the program logic and flow - when the objects allowed to created and destroyed, then by using GC.addRoot/GC.removeRoot keep them alive and release when no longer needed.
Can the garbage collector stop the threads as needed?
No.