Chris Angelico <ros...@gmail.com> writes: > Or let's look at it a different way. Instead of using a PyObject* in C > code, you could write C++ code that uses a trivial wrapper class that > holds the pointer, increments its refcount on construction, and > decrements that refcount on destruction.
That's the C++ STL shared_ptr template. Unfortunately it has the same problem as Python refcounts, i.e. it has to use locks to maintain thread safety, which slows it down significantly. The simplest way to start experimenting with GC in Python might be to redefine the refcount macros to do nothing, connect the allocator to the Boehm GC, and stop all the threads when GC time comes. I don't know if Guile has threads at all, but I know it uses the Boehm GC and it's quite effective. -- https://mail.python.org/mailman/listinfo/python-list