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 9/9] Remove a useless Guile finalizer


On Sat 12 Apr 2014 22:18, Doug Evans <xdje42@gmail.com> writes:

> Andy Wingo <wingo@igalia.com> writes:
>
>> * gdb/guile/scm-symtab.c (stscm_free_sal_smob): Remove useless free
>>   function.  (This was the only useless free function.)
>
> How useful is valgrind with Guile's GC?

It seems to work fine now, and in my recollection, but I haven't used
memcheck in anger recently.  I usually use callgrind ;).  The GC heap
doesn't present any problems for it.  Conservative root scanning on the
stack and in the static data sections is an issue; you have to add some
things to the suppressions for sanity.

> And given that we have this hook, it seems a shame to just throw out
> such useful protections against use-after-free (I'm pretty sure early on
> I found one bug with them), especially given the subtleties with GC,
> and gdb's extensive need to have references to SCM objects from outside
> GC-controlled code.

Thing is, you don't control very much about the environment of the
finalizer.  In particular it could be called from some other thread, and
in general a finalizer runs concurrently with arbitrary other parts of
your program; see
http://wingolog.org/archives/2012/02/16/unexpected-concurrency for some
discussion.  Avoiding finalizers can actually improve correctness in
this regard.

> If we're going to have a rule that such code is disallowed,
> there is more such code that needs to be removed besides the above
> (grep for "catch bugs").

Sure.  I think I looked for finalizers that _only_ had this kind of
body, and this was the only one.  It's harmless otherwise.  Finalizers
do impose a perf penalty on the GC, but it's much less than mark
functions.

Andy


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