Pyffi - Use Python from Racket

It would be lovely if the garbage collectors of the two systems could interact properly.

Python uses reference counting (there is not much to do about that).

When a Python value is allocated from Racket, the Racket side gets a pointer to a C-struct.
This C-struct contains a reference count, which we increment (so the Python garbage collector
doesn't remove values used by Racket). On the Racket side the pointer is associated with a "will executor". When Racket determines that the value is dead, we decrement the Python
reference count. This allows the Python side to reclamin the memory.

2 Likes