This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] [5/5] Types reference counting [value_history_cleanup]


>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> There is now a fix to free anything at all.  When the function
Jan> was written there was an older implementation of type_decref
Jan> which was incorrectly freeing the zero-reference-count types
Jan> immediately (and not just on the garbage collection by
Jan> free_all_types).

Jan> gdb/
Jan> 2009-04-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	* value.c (value_history_cleanup): New function.
Jan> 	(_initialize_values): Setup a value_history_cleanup final call.

I don't generally like to add work on the exit path.

So, I think your initial comment was on target -- we should have some
kind of checking mode that enables this; and then do like GCC and
arrange to have it enabled in non-release builds.

Jan> +/* Sanity check for memory leaks and proper types reference counting.  */
Jan> +
Jan> +static void
Jan> +value_history_cleanup (void *unused)
Jan> +{

This should probably free values_in_python as well.

I don't think we have a convenient way to destroy all the types
referenced by Type objects, but perhaps we ought to add one for this.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]