Battle of the garbage collectors, or ARGGHHHHHH!!!!
cfkaran2 at gmail.com
Mon Apr 24 20:53:12 EDT 2017
On Apr 24, 2017, at 6:59 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 4/24/2017 6:24 PM, CFK wrote:
>> TLDR version: the bdwgc garbage collector (http://www.hboehm.info/gc/) and
>> python's collector are not playing nice with one another, and I need to
>> make them work with each other.
>> Long version: I'm trying to write bindings for python via ctypes to control
>> a library written in C that uses the bdwgc garbage collector (
>> http://www.hboehm.info/gc/). The bindings mostly work, except for when
>> either bdwgc or python's garbage collector decide to get into an argument
>> over what is garbage and what isn't, in which case I get a segfault because
>> one or the other collector has already reaped the memory. I need the two
>> sides to play nice with one another. I can think of two solutions:
>> First, I can replace Python's garbage collector via the functions described
>> at https://docs.python.org/3/c-api/memory.html#customize-memory-allocators
>> so that they use the bdwgc functions instead. However, this leads me to a
>> whole series of questions:
>> 1. Has anyone done anything like this before?
> I know that experiments have been done.
> Have you tried searching 'Python bdwgc garbage collection' or similar?
I did google around a bit, but the results I found weren't relevant. I was hoping someone else on the list had tried, and simply hadn't gotten around to posting about it anywhere yet.
More information about the Python-list