This is the mail archive of the
mailing list for the Archer project.
Re: [python] don't try to free "independent" types
- From: Tom Tromey <tromey at redhat dot com>
- To: Chris Moller <cmoller at redhat dot com>
- Cc: Project Archer <archer at sourceware dot org>
- Date: Tue, 25 Nov 2008 14:42:31 -0700
- Subject: Re: [python] don't try to free "independent" types
- References: <email@example.com> <492C6EAF.firstname.lastname@example.org>
- Reply-to: Tom Tromey <tromey at redhat dot com>
>>>>> "Chris" == Chris Moller <email@example.com> writes:
Tom> After considering this for a while I arrived at the conclusion that,
Tom> short of a value-and-type garbage collector, there is not much that
Tom> can be done.
Chris> Any way to implement reference counts with a free-on-count-equal-zero
Chris> sort of thing? (This may be a phenomenally bone-headed suggestion--I
Chris> don't know a thing about python. If it is, consider it the
It isn't boneheaded. However, is what the code did before the patch.
The problem is that only the Python layer was using reference counting
(and not even consistently, as the Value.type example shows).
However, there were cases where the underlying type could leak out,
like the script in the message.
FWIW pure reference counting won't work even if we applied it to all
of gdb, because types are recursive. E.g., a struct type can have a
field whose type is a pointer to the struct.
But, maybe some hybrid scheme could work. I tend to just treat
reference counting as a particular style of GC, my word choice there
wasn't meant to imply a particular implementation. The difficult bit,
as I see it, is that it would have to be used consistently in gdb, and
that implies a fairly invasive change.