|
|
Subscribe / Log in / New account

An introduction to asynchronous Python

An introduction to asynchronous Python

Posted Jun 30, 2017 5:50 UTC (Fri) by epa (subscriber, #39769)
In reply to: An introduction to asynchronous Python by dtlin
Parent article: An introduction to asynchronous Python

Ironically, if you use a worker process model you may not need reference counting or other forms of garbage collection at all. Each process can do some work and then exit, freeing its memory then. This suggests some global flag to turn off reference counting and garbage collection would help here - and perhaps also help non-forking programs which nonetheless do one thing and then exit.

A more subtle tweak would be to set the reference counts on all objects to some magic value like -1 which marks an object as used and stops the count being updated further. The parent process could call that as a one-off just before forking the workers. Then all existing objects would stay shared, but allocations made in the children (or further things allocated in the parent) would be garbage collected as usual.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds