Re: [RFC 0/9] Attempt to unify Python object's lifecycle

Tom Tromey
2025-02-20T19:19:46Z

>>>>> "Jan" == Jan Vrany <jan.vrany@labware.com> writes:

Jan> My idea was to refactor this housekeeping code into a common class.

Thanks for doing this.

Jan> It could go further (one can convert gdb.Block too and
Jan> gdb.Value and gdb.Value.type and dynamic_type could be
Jan> further simplified too) but I decided to stop here.

I think gdb.Value might be harder as it has some special requirements.
In particular there is code in there to ensure that using the gdb.Value
API doesn't cause too much memory retention -- the "temporary" strategy
that's discussed in another sub-thread. Also the underlying "struct
value" memory management approach is odd.

Jan> All in all, I'm not sure this is the best approach and worth
Jan> it. By this RFC, I'd like to solicit feedback from experienced
Jan> GDB developers on how to move on.

Jan> Basically I see following options:

Jan> 1) Do not change anything in this area (I'm perfectly
Jan> happy with that).
Jan> 2) Intern (memoize) Python objects (where it makes sense)
Jan> but keep the current approach. Basically first four
Jan> commits of this RFC.
Jan> 3) Continue working on this.

I think #3.

I'll send a couple small comments.

Tom