Liste des Groupes | Revenir à cl c |
07.03.2024 17:36 David Brown kirjutas:Yes, that is my understanding too. (I could be wrong here, so don't rely on anything I write!) But the way it is used is still a type of garbage collection. When an object no longer has any "live" references, it is put in a list, and on the next GC it will get cleared up (and call the asynchronous destructor, __del__, for the object).>AFAIK CPython uses reference counting, i.e. basically the same as C++ std::shared_ptr (except that it does not need to be thread-safe).
CPython does use garbage collection, as far as I know.
>
With reference counting one only knows how many pointers there are to a given heap block, but not where they are, so heap compaction would not be straightforward.
Python also has zillions of extensions written in C or C++ (all of AI related work for example), so having e.g. heap compaction of Python objects only might not be worth of it.
Les messages affichés proviennent d'usenet.