This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 9/9] Remove a useless Guile finalizer
- From: Andy Wingo <wingo at igalia dot com>
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 17 Apr 2014 12:07:40 +0200
- Subject: Re: [PATCH 9/9] Remove a useless Guile finalizer
- Authentication-results: sourceware.org; auth=none
- References: <1397060028-18158-1-git-send-email-wingo at igalia dot com> <1397060028-18158-10-git-send-email-wingo at igalia dot com> <m3ob06s3ne dot fsf at sspiff dot org>
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